import java .awt .*;
import java .applet .*;
import java .awt.event .*;public class Class1 extends Applet implements ActionListener
{
Button button1=new Button ("hello");
Button button2=new Button ("thanks");
String str;public void init()
{
button1.addActionListener (this);
button2.addActionListener (this);
add(button1);
add(button2);
}
public void paint(Graphics g)
{
if(str!=null)
g.drawString (str,30,100);
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==button1)
    //if(e.equals (button1))
  {
str="hello";
repaint();
}
else if(e.getSource()==button2)
//else if(e.equals (button2))
{
str="not at all";
repaint();
}
}}