

What modifiers may be used with an inner class that is a member of an outer class?Īnswer: A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.ġ7. Which containers use a Flow Layout as their default layout?Īnswer: The Panel and Applet classes use the Flow Layout as their default layout.ġ6. When a thread blocks on I/O, what state does it enter?Īnswer: When it blocks on I/O, A thread enters the waiting state.ġ5. what value is a variable of the String type automatically initialized?Īnswer: The default value of a String type is null.ġ4. If we want to rethrow checked exceptionįrom a catch block we need to declare that exception.ġ3. Can we rethrow the same exception from catch handler?Īnswer: Yes, we can rethrow the same exception from our catch handler. What is the immediate superclass of the Applet class?Īnswer: The Panel class is the immediate superclass of the Applet class.ġ2. What method is used to specify a container’s layout?Īnswer: The setLayout() method is used to specify a container’s layout.ġ1. These methods have been deprecated in JDK 1.2.ġ0. What’s new with the stop(), suspend() and resume() methods in JDK 1.2 ?
#TOP 100 JAVA INTERVIEW QUESTIONS CODE#
What restrictions are placed on the location of a package statement within a source code file?Īnswer: A package statement must appear as the first line in a source code file (eliminating blank lines and comments).Īnswer: A transient variable is a variable that may not be serialized.ĩ. Does Java support multiple inheritances?Īnswer: Java doesn’t support multiple inheritances.Ħ. These new data types are used to create objects.Īnswer: JVM is Java Virtual Machine which is a run time environment for the compiled java class files.Īnswer: When a Java program contains more than one methods with the same name but different properties, then it is called method overloading.ĥ.


What is the right data type to represent a price in Java?Īnswer: BigDecimal, if memory is not a concern and Performance, is not critical, otherwise double with predefined precision.Īnswer: Java encapsulates the codes in various classes which define new data types.
