Question 1
Question 5
abstract class demo
{
public int a;
demo()
{
a = 10;
}
abstract public void set();
abstract final public void get();
}
class Test extends demo
{
public void set(int a)
{
this.a = a;
}
final public void get()
{
System.out.println(\"a = \" + a);
}
public static void main(String[] args)
{
Test obj = new Test();
obj.set(20);
obj.get();
}
}
Question 7
Which of the following is true about interfaces in java.
1) An interface can contain following type of members. ....public, static, final fields (i.e., constants) ....default and static methods with bodies 2) An instance of interface can be created. 3) A class can implement multiple interfaces. 4) Many classes can implement the same interface.
There are 7 questions to complete.