1 import java.applet.Applet;
2 import java.awt.*;
3 import java.awt.event.*;
4 public class hello4 extends
Applet {
5 public void init(){
6 add(new myButton("BBB"));
7 }
8 public void paint(Graphics screen) {
9 }
10 class myButton extends Button{
11 myButton(
String label){
12 super(label);
13 }
14 public String paramString(){
15 return super.paramString();
16 }
17 }
18 public static void main(String[] args){
19 Frame myFrame = new Frame(
20 "Copyright Amit");
21 myFrame.setSize(300,100);
22 Applet myApplet = new hello4();
23 Button b = new Button("My Button");
24 myApplet.add(b);
25 b.setLabel(b.getLabel()+"New");
26 // myButton b1 =(new hello4()).new myButton("PARAMBUTTON");
27 System.out.println(b1.paramString());
28 myFrame.add(myApplet);
29 myFrame.setVisible(true);
30 myFrame.addWindowListener(new WindowAdapter(){
31 public void windowClosing(WindowEvent e){
32 System.exit(0);}});
33 }
34 } //End hello4 class.
Q4 In the code if you compile as "javac hello4.java" following files will be generated.
a) hello4.class, myButton.class,hello41.class
b)hello4.class, hello4$myButton.class,hello4$1.class
c)hello4.clas,hello4$myButton.class
Correct answer is b)
In b) hello4$1.class represents which class???For which class
is it created.
thanks!