ACTUAL QUESTIONS AND CORRECTLY
WELL DEFINED ANSWERS LATEST
ALREADY GRADED A+
Use the following partial class definitions:
public class A1
{
public int x;
private int y;
protected int z;
...
}
public class A2 extends A1
{
protected int a;
private int b;
...
,}
public class A3 extends A2
{
private int q;
...
}
Which of the following lists of instance data are accessible
in A3?
a) x, z, a, q
b) x, y, z, a, b, q
c) a, q
d) x, a, q
e) a, b, q - ANSWERS-a) x, z, a, q
Use the following partial class definitions:
public class A1
{
public int x;
private int y;
protected int z;
,...
}
public class A2 extends A1
{
protected int a;
private int b;
...
}
public class A3 extends A2
{
private int q;
...
}
Which of the following is true regarding the use of instance
data y of class A1?
a) it is accessible in A1 and A2
b) it is accessible in A1, A2 and A3
c) it is accessible only in A3
d) it is accessible only in A1
, e) it is not accessible to any of the three classes - ANSWERS-
d) it is accessible only in A1
All classes in Java are directly or indirectly subclasses of the
_______ class.
a) Object
b) this
c) Reference
d) String
e) Wrapper - ANSWERS-a) Object
Which of the following is not a method of the Object class?
a) toString
b) equals
c) compareTo
d) clone - ANSWERS-c) compareTo
Why shouldn't an abstract method be declared final?