public class Test {
public static void main(String args[]) {
Person p = new Student();
p.talk();
}
}
2.
What is the output of the following Java code:
class Men {
public int number;
}
public class Test {
public void doIt(int i, Men p) {
i = 5;
p.number = 8;
}
public static void main(String args[]) {
int x = 0;
Men p = new Men();
new Test().doIt(x, p);
System.out.println(x + " " + p.number);
}
}
3.
In Java, how is an object serialized?
4.
What is the output of the following Java code:
class A {
final public int GetResult(int a, int b) {
return 0;
}
}
class B extends A {
public int GetResult(int a, int b) {
return 1;
}
}
public class Test {
public static void main(String args[]) {
B b = new B();
System.out.println("x = " + b.GetResult(0, 1));
}
}
5.
The following C segment is equivalent to ______________________.