Following quiz provides Multiple Choice Questions (MCQs) related to Core Java. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - What is correct syntax for main method of a java class?
Correct syntax is public static void main(String args).
True, a java file can contain one public class and many other non-public classes.
String variable has default value of null if defined as an instance/static variable.
Q 4 - Which of the following is true about String?
String object is immutable so that once it is created a String object cannot be changed. Since String is immutable it can safely be shared between many threads which are considered very important for multithreaded programming.
Q 5 - What is Encapsulation?
It is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. Therefore encapsulation is also referred to as data hiding.
No, this is not possible.
Q 7 - Dynamic binding uses which information for binding?
Dynamic binding uses object information for binding.
Q 8 - What is Serialization?
Serialization is the process of writing the state of an object to a byte stream.
Q 9 - Which arithmetic operations can result in the throwing of an ArithmeticException?
Integer / and % can result in the throwing of an ArithmeticException.
Q 10 - What is currentThread()?
currentThread() is a public static method of Thread class used to obtain a reference to the current thread.