Monday 23 October 2017

JAVA Interview Questions Page5


The following shows the explanation individually −
  • public − it is the access specifier.
  • static − it allows main() to be called without instantiating a particular instance of a class.
  • void − it affirns the compiler that no value is returned by main().
  • main() − this method is called at the beginning of a Java program.
  • String args[ ] − args parameter is an instance array of class String
Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application;
JAR files is Java Archive fles and it aggregates many files into one. It holds Java classes in a library. JAR files are built on ZIP file format and have .jar file extension.
This is Web Archive File and used to store XML, java classes, and JavaServer pages. which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, static Web pages etc.
It improves the runtime performance of computer programs based on bytecode.
Object based programming languages follow all the features of OOPs except Inheritance. JavaScript is an example of object based programming languages.
The java compiler creates a default constructor only if there is no constructor in the class.
No, this is not possible.
It is used to initialize the static data member, It is excuted before main method at the time of classloading.
Holding the reference of the other class within some other class is known as composition.
If a class has multiple functions by same name but different parameters, it is known as Method Overloading.
If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.
Method overloading increases the readability of the program. Method overriding provides the specific implementation of the method that is already provided by its super class parameter must be different in case of overloading, parameter must be same in case of overriding.
Final classes are created so the methods implemented by that class cannot be overridden. It can’t be inherited.
A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.





A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.