import java.awt.*;
import javax.swing.*;
/*<applet code="SampleApplet1",200,300>
*/

public class SampleApplet1 extends JApplet
{
int num;
public void init()
{
num=20;
}

public void paint(Graphics g)
{
g.drawString("Hello to Applets.Session"+num,70,80);
g.showStatus(getAppletInfo);
}

public int getAppletInfo()//Overrides super class method
{
return("Created by PTSS");
}

public static void main(String arg[])
{
SampleApplet1 obj= new SampleApplet1();
obj.init();
System.out.println("Application Main");
}
}


there was an error plez help me..

Recommended Answers

All 2 Replies

import java.awt.*;
import javax.swing.*;
/*<applet code="SampleApplet1",200,300>
*/

public class SampleApplet1 extends JApplet
{
int num;
public void init()
{
num=20;
}

public void paint(Graphics g)
{
g.drawString("Hello to Applets.Session"+num,70,80);
g.showStatus(getAppletInfo);
}

public int getAppletInfo()//Overrides super class method
{
return("Created by PTSS");
}

public static void main(String arg[])
{
SampleApplet1 obj= new SampleApplet1();
obj.init();
System.out.println("Application Main");
}
}


there was an error plez help me..

Care to explain what the error was ? was it a runtime error or compilation error? what does the error message say?

the return type of method getAppletInfo() should String as your are returning String value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.