Java Reference
In-Depth Information
7. The
class
Animal
is the base class and the
class
Dog
is the derived class.
9.
a. The statement:
class
BClass AClass
should be:
class
BClass
extends
AClass
b. Variables
u
and
v
are private in
class
AClass
and cannot be accessed directly
in
class
BClass
.
11.
a.
public
YClass()
{
a = 0;
b = 0;
}
b.
public
XClass()
{
super
(0, 0);
z = 0;
}
c.
public void
two(
int
x,
int
y)
{
a = x;
b = y;
}
13. In overloading, two or more methods have the same name but have different
formal parameter lists. In overriding, you are redefining a method of a superclass
in a subclass. The two methods (the method in the superclass and its redefinition in
the subclass) have the same name and formal parameter list.
15. The
class
GradStudent
has two
printGrades
methods and their headings are:
public void
printGrades()
and
public void
printGrades(String
status)
17.
a.
public void
setData(
int
a,
int
b,
int
c)
{
super
.setData(a, b);
z = c;
}
b.
public void
print()
{
super
.print();
System.out.println(z);
}
Search WWH ::
Custom Search