i cannot find the error

class Sample {void Method() {System.out.println("I am John");}public static void main(String arguments) {Sample s=new Sample();s.Method();}}where is it?
[222 byte] By [jonsofa] at [2007-9-27 7:54:55]
# 1

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

narcca at 2007-7-8 12:23:54 > top of Java-index,Developer Tools,Java Compiler...
# 2

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

wywiwyga at 2007-7-8 12:23:54 > top of Java-index,Developer Tools,Java Compiler...