Home » » Latest Java interview questions and answers 2013-2014 Continue

Latest Java interview questions and answers 2013-2014 Continue

  1. What is a DatabaseMetaData? - Comprehensive information about the database as a whole.
  2. What is Locale? - A Locale object represents a specific geographical, political, or cultural region
  3. How will you load a specific locale? - Using ResourceBundle.getBundle(…);
  4. What is JIT and its use? - Really, just a very fast compiler… In this incarnation, pretty much a one-pass compiler — no offline computations. So you can’t look at the whole method, rank the expressions according to which ones are re-used the most, and then generate code. In theory terms, it’s an on-line problem.
  5. Is JVM a compiler or an interpreter? - Interpreter
  6. When you think about optimization, what is the best way to findout the time/memory consuming process? - Using profiler
  7. What is the purpose of assert keyword used in JDK1.4.x? - In order to validate certain expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing.
  8. How will you get the platform dependent values like line separator, path separator, etc., ? - Using Sytem.getProperty(…) (line.separator, path.separator, …)
  9. What is skeleton and stub? what is the purpose of those? - Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.
  10. What is the final keyword denotes? - final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more.
  11. What is the significance of ListIterator? - You can iterate back and forth.
  12. What is the major difference between LinkedList and ArrayList? - LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.
  13. What is nested class? - If all the methods of a inner class is static then it is a nested class.
  14. What is inner class? - If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class.
  15. What is composition? - Holding the reference of the other class within some other class is known as composition.
  16. What is aggregation? - It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation.
  17. What are the methods in Object? - clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString
  18. Can you instantiate the Math class? - You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public.
  19. What is singleton? - It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … }
  20. What is DriverManager? - The basic service to manage set of JDBC drivers.
  21. What is Class.forName() does and how it is useful? - It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).
  22. Inq adds a question: Expain the reason for each keyword .

0 comments:

Post a Comment