Set - 7

Question 56 :

Explain the different forms of Polymorphism.

Answer :

From a practical programming viewpoint, polymorphism exists in three distinct forms in Java:

Method overloading
Method overriding through inheritance
Method overriding through the Java interface


Question 57 :

What are Access Specifiers available in Java?

Answer :

ccess specifiers are keywords that determines the type of access to the member of a class. These are:

Public
Protected
Private
Defaults


Question 58 :

Describe the wrapper classes in Java?

Answer :

Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type.
Following table lists the primitive types and the corresponding wrapper classes:

Primitive Wrapper
boolean java.lang.Boolean
byte java.lang.Byte
char java.lang.Character
double java.lang.Double
float java.lang.Float
int java.lang.Integer
long java.lang.Long
short java.lang.Short
void java.lang.Void


Question 59 :

Use the Externalizable interface when you need complete control over your Bean's serialization (for example, when writing and reading a specific file format).

Answer :

No. Earlier order is maintained.


Question 60 :

Read the following program:

public class test {
	public static void main(String [] args) {
		int x = 3;
		int y = 1;
		if (x = y)
			System.out.println("Not equal");
		else
			System.out.println("Equal");
	}
}

What is the result?


A). The output is "Equal"
B). The output in "Not Equal"
C). An error at " if (x = y)" causes compilation to fall.
D). The program executes but no output is show on console.
Answer : Option C