Java Reference
In-Depth Information
Further suppose that the class GradStudent has the following method:
public void printGrades(String status)
How many printGrade methods will the class GradStudent have and
what are their headings?
Suppose that you have the following class:
public class classA
{
16.
private int x;
//Line 1
protected void setX( int a)
//Line 2
{
//Line 3
x = a;
//Line 4
}
}
What is wrong with the following code?
public class Exercise16
//Line 5
{
public static void main(String[] args) //Line 6
{
classA aObject;
//Line 7
aObject.setX(4);
//Line 8
}
}
Suppose that you have the following class definitions:
public class One
{
17.
private int x;
private int y;
public void print()
{
System.out.println(x + " " + y);
protected void setData( int u, int v)
{
x = u;
y = v;
}
}
Consider the following class definitions:
public class Two extends One
{
private int z;
Search WWH ::




Custom Search