errors in classes
Im just new to java and need help with this Question. i know the answer is e) and understand how all the ones above it work but i do not understand why it would create an error. thanx.
Consider the following two classes:
class C1
{
private int v1;
private static int v2;
public void setV1 (int val)
{
v1 = val;
}
public static void setV2(int val)
{
v2 = val;
}
}
class C2
{
public static char[] v3={'a','b'};
private int v4;
public C2 (int n)
{
v4 = n;
}
public void m1 (C1 x)
{
x.setV1(5);
}
}
Suppose that the following instructions are used in the main() method in a class Test. Each choice
should be considered independently ?as it if were in its own main() method. Circle the letter of
the statement which causes an error.
a) C1 x = new C1();
x.setV1(6);
b) C2.v3[1] = "c".charAt(0);
c) C2 z = new C2(10);
d) C1.setV2(C2.v3.length);
e) C1 y = new C1();
C2.m1(y);

