A native method is a method that is implemented in a language other than Java.
Author: nandu
In System.out.println(), what is System, out and println?
System is a predefined final class, out is a PrintStream object and println is a built-in overloaded method in the out object.
What is implicit casting?
Implicit casting is the process of simply assigning one entity to another without any transformation guidance to the compiler. This type of casting is not permitted in all kinds of transformations and may not work for all scenarios. Example int i = 1000; long j = i; //Implicit casting
How to convert String to Number in java program?
The valueOf() function of Integer class is is used to convert string to Number. Here is the code example: String numString = “1000″; int id=Integer.valueOf(numString).intValue();
Why there are no global variables in Java?
Global variables are globally accessible. Java does not support globally accessible variables due to following reasons: The global variables breaks the referential transparency Global variables create collisions in namespace.
What is the Java API?
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
What is the difference between final, finally and finalize? What do you understand by the java final keyword?
final – declare constant finally – handles exception finalize – helps in garbage collection Variables defined in an interface are implicitly final. A final class can’t be extended i.e., final class may not be subclassed. This is done for security reasons with basic classes like String and Integer. It also allows the compiler to make […]
What if the static modifier is removed from the signature of the main method?
Program compiles. But at runtime throws an error “NoSuchMethodError”.
What are the differences between == and .equals() ?
The == operator compares two objects to determine if they are the same object in memory i.e. present in the same memory location. It is possible for two String objects to have the same value, but located in different areas of memory. == compares references while .equals compares contents. The method public boolean equals(Object obj) […]
Expain the reason for each keyword of public static void main(String args[])?
public – main(..) is the first method called by java environment when a program is executed so it has to accessible from java environment. Hence the access specifier has to be public. static : Java environment should be able to call this method without creating an instance of the class , so this method must […]