Basic Java Interview Question and Answers

65. What is the difference amongst JVM Spec, JVM Implementation, JVM Runtime?
  The JVM spec is the blueprint for the JVM generated and owned by Sun. The JVM implementation is the actual implementation of the spec by a vendor and the JVM runtime is the actual running of a JVM implementation.
 
Your Name Your Email-ID
Your Answer
66. What is a class loader and what are its responsibilities?
 
  • The Class loader is a subsystem of a JVM which is responsible, predominantly for loading classes and interfaces in the system. Apart from this, a class loader is responsible for the following activities.
  • Verification of imported types (classes and interfaces)
  • Allocating memory for class variables and initializing them to default values. Static fields for a class are created and these are set to standard default values, But they are not explicitly initialized. The method tables are constructed for the class
 
Your Name Your Email-ID
Your Answer
67. What is the difference between instance and isInstance?
  Instance is used to check to see if an object can be cast into a specified type without throwing a cast exception. isInstance() Determines if the specified Object is assignment compatible with the object represented by this class. This method is the dynamic equivalent of the Java language instanceof operator.
The method returns true if the specified Object arguments is non null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise.
 
Your Name Your Email-ID
Your Answer
68. Can we call the non static variables into static methods?
  No, vice versa is not possible.
 
Your Name Your Email-ID
Your Answer