Could anyone explain the two questions below??
Q1)
import java.awt.*;
import java.awt.event.*;
public class
Test {
public static void main(
String args[] ) {
String s = "Happy";
Frame f = new Frame();
Button btn = new Button();
btn.addActionListener(
new ActionListener(){
public void actionPerformed( ActionEvent e ){
System.out.println( "Message is " + s );
}
}
);
f.add( btn );
f.setVisible( true );
}
}
��A. both compile and runtime is successful but nothing is displayed
��B. both compile and runtime is successful and
if you click button display "Message is Happy
��C. compile is successful but runtime is fail
��D. compile is failed because String s cannot be used .........
��E. compile is failed because class Test ......... not implements ActionListener
ans) D why??
Q2
48. Which statement is true about GridBagLayout ?
��A. Values of weightx and weighty must be in the range 0.0 to 1.0
��B. The fill value for a component is irrelavant if the anchar value is CENTER
��C. The last component in a row must be flagged using the REMAINDER value
��D. The anchor value for a component is irrelavant if the fill value for
the component is BOTH
��E. At most one row can change height and at most one column may change width
when the container is resized
ans ??
thank you so much!