I feel that answer to question no8 of sample questions(from sun) provided by is wrong.
According to them it is b)
but I feel that a) is the correct answer because extend
word has been used instead of extends
import java.awt.*;
public class
Test extend Frame {
public Test() {
add( new Label("Hello") );
add( new TextField("Hello") );
add( new Button("Hello") );
pack();
show();
}
public static void main(
String args[]) {
new Test();
}
}
What is the result?
a)The code will not complile.
b)A window will appear containing only a Button.
c)An IllegaArgumentException is thrown at line 6.
d)A window will appear but will not contain the Label, TextField, or Button.
e)A window will appear containing a Label at the top, a TextField below the Label, and a Button below the TextField.
f)A window will appear containing a Label on the left, a TextField to the right of the Label, and a Button to the right of the TextField .
[This message has been edited by Rahul Agarwal (edited October 05, 2000).]