//Problem to illustrate the use of set Background and Set foreground functions.
//Solution :
import java.awt.*;
import java.applet.*;
/*
<applet code=”applet2" height=200 width=300>
</applet>
*/
class applet2 extends Applet{
String meg;
public void init()
{
setBackground(Color.green);
setForeground(Color.red);
meg="Method inside init";
}
public void start()
{
meg+=" Method inside start";
}
public void stop()
{
}
public void paint(Graphics g)
{
g.drawString(meg,50,50);
}
}