Prog MCQ1
Prog MCQ1
Q1: Observe the following code and find which statement contains error.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.event.*;
public class ttp extends JApplet implements ActionListener {
JButton jb = new JButton("click me");
JTextField text = new JTextField(20);
public void init() {
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
jb.setToolTipText("this is button control");
add(jb);
add(text);
text.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
text.setText("hello tyco");
}
}
----------------------------------------------------------------------------------------------------------------------
Q3: Consider following program and find the missing statement in the code
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
/*<applet code=exp1.class width=200 height=200> </applet> */
public class exp1 extends Applet {