However i am told the above code would not be written by an


The following lines of code compile and run:

JOptionPane jop = new JOptionPane( );
jop.showMessageDialog("This is never done");

However, I am told the above code would not be written by an experienced Java programmer because the showMessageDialog method is static within the class. How would a pro would write it?

Also, how would you modify the following classes so class A inherits from class B, and class B inherits from class C?

public class A
{
private int x;

public A(int n)
{

x = n;

}
}

public class B
{
protected int x, z;

public B(int a, int b)
{

x = a;
z = b;

}
}

public class C
{
private String s;

public C(String x)
{

s = x;

}
}

Solution Preview :

Prepared by a verified Expert
JAVA Programming: However i am told the above code would not be written by an
Reference No:- TGS01249291

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)