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.
The byte data type is represented by an 8-bit signed two's complement integer.
Minimum value: -128
Maximum value: 127
No, a java file can contain only one public class.
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 an immutable object?
A - An immutable object can be changed once it is created.
B - An immutable object can't be changed once it is created.
C - An immutable object is an instance of an abstract class.
An immutable object can't be changed once it is created. String objects are immutable.
Q 6 - What kind of variables a class can consist of?
A - class variables, instance variables
A class consist of Local variable, instance variables and class variables.
Q 7 - Method Overloading is an example of
Method Overloading is example of static binding.
Q 8 - Which is the way in which a thread can enter the waiting state?
A - Invoke its sleep() method.
B - invoke object's wait method.
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.
No, a top level class can not be private or protected. It can have either "public" or no modifier.
Postfix operators i.e () [] . is at the highest precedence.