A native method is a method that is implemented in a language other than Java.
System is a predefined final class, out is a PrintStream object and println is a built-in overloaded method in the out object.
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
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();
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.
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
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 […]
Program compiles. But at runtime throws an error “NoSuchMethodError”.
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) […]
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 […]