WTF?

  • Thread starter Mad_man_on_a_MissIon
  • Start date
M

Mad_man_on_a_MissIon

Here is the code:

public class Test {
public static void main() {
System.out.println("Testing ....");
}

}

yet I am getting this error .....Exception in thread "main"
NoSuchMethodError : main

Why?

I run: javac Test.java
java Test
 
T

trippy

Mad_man_on_a_MissIon took the hamburger meat, threw it on the grill, and
I said "Oh Wow"...
Here is the code:

public class Test {
public static void main() {
System.out.println("Testing ....");
}

}

yet I am getting this error .....Exception in thread "main"
NoSuchMethodError : main

Why?

I run: javac Test.java
java Test

public static void main(String[] args)

There is no no-argument main.

--
trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

NP: "The American Way" -- Sacred Reich

"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum, a pocketknife,
and a smile."

-- Robert Redford "Spy Game"
 
D

Daniel Pitts

Mad_man_on_a_MissIon said:
Here is the code:

public class Test {
public static void main() {
System.out.println("Testing ....");
}

}

yet I am getting this error .....Exception in thread "main"
NoSuchMethodError : main

Why?

I run: javac Test.java
java Test

when you run "java Test". it looks for the class Test (which it finds)
and then looks for public static void main(String[] args), which it
doen't find. Hence the error.

Try adding String[] args to your parameters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top