can someone plz explain why each option is valid or invalid..i have no clue of waht is going on in these questions? all i can see are they are being multiplied?.. i do not understand these attributes and instances and cannot find any helpful resources either? i know in the question below does not ask for attributes or instances but if u could in brief about the classes?
49. Given the following:-
class H {
public int z;
public String x;
}
class G extends H {
public double w;
public double y( ) { }
}
Which one of the following sets of statement is not valid:-
a) H r = new H( ); r.z = 99;
b) G r = new G( ); r.z = 9;
c) G r = new G( ); double d = r.y( );
d) G r = new G( ); r.w = 9.9;
e) H r = new H( ); r.x = 9.9;
Given the following Java code:-
public class D{
private int a;
private String c;
}
Which one of the following sets of statements is valid
a) D p = new D( ); p.a = p.a + 3;
b) D p.a = new D( ) + 3;
c) D p = new( ); a = a + 3;
d) D p = new D( ); a.p = a.p + 3;
e) D p.a = new(int) + 3