12.What is Singleton class?
Singleton class control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes.
13.What do you mean by Constructor?
Constructor gets invoked when a new object is created. Every class has a constructor. If we do not explicitly write a constructor for a class the java compiler builds a default constructor for that class.
14.List the three steps for creating an Object for a class?
An Object is first declared, then instantiated and then it is initialized.
15.What is the default value of byte datatype in Java?
Default value of byte datatype is 0.
16.What is the default value of float and double datatype in Java?
Default value of float and double datatype in different as compared to C/C++. For float its 0.0f and for double it’s 0.0d
17.When a byte datatype is used?
This data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.
18.What is a static variable?
Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.
19.What do you mean by Access Modifier?
Java provides access modifiers to set access levels for classes, variables, methods and constructors. A member has package or default accessibility when no accessibility modifier is specified.
20.What is protected access modifier?
Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members’ class.