Your trying to create an instance of your object from inside itself. You can't do that.
Try this instead:
public class Sample
{
void Method()
{
System.out.println("Test...");
}
public static void main(String arguments)
{
Method();
}
}
Or you could try:
class Sample
{
void Method()
{
System.out.println("Test...");
}
}
public class RunSample
{
public static void main(String arguments)
{
Sample s=new Sample();
s.Method();
}
}
--Dave
The error is that your main doesn't take a String[]. change it to the following:
public class Sample {
void Method() {
System.out.println("I am John");
}
public static void main(String[] arguments) {
Sample s = new Sample();
s.Method();
}
}
m