What is => "java.lang.NoSuchMethodError: main Exception in thread "main" "

When I run mainClass , this error appears.

java.lang.NoSuchMethodError: main Exception in thread "main"

===============================

my main class

publicclass Main2{

publicstaticvoid main(String args[])

{

MainClass_1 a =new MainClass_1();

a.yaz();

}

}

===

MainClass_1 =>

publicclass MainClass_1{

private MonetaryCoin[] para;

public MainClass_1()

{

para =new MonetaryCoin[3];

para[0] =new MonetaryCoin();

para[0].setValue(150);

para[0].flip();

para[1] =new MonetaryCoin();

para[1].setValue(250);

para[1].flip();

para[2] =new MonetaryCoin();

para[2].setValue(350);

para[2].flip();

}

publicvoid yaz()

{

System.out.println(" For para0 => " + para[0].getValue() +"\t HEADS=>" + para[0].isHeads() );

System.out.println(" For para1 => " + para[1].getValue() +"\t HEADS=>" + para[1].isHeads() );

System.out.println(" For para2 => " + para[2].getValue() +"\t HEADS=>" + para[2].isHeads() );

}

}

======

MonetaryCoin

publicclass MonetaryCoinextends Coin{

privateint value = 0;

public MonetaryCoin(){}

publicvoid setValue(int value)

{

this.value = value;

}

publicint getValue()

{

return value;

}

}

the coin class has already worked.

thanks ..

null

[3037 byte] By [futia] at [2007-11-26 19:23:34]
# 1
It should be String[] args, not String args[]
abu5ea at 2007-7-9 21:45:20 > top of Java-index,Java Essentials,Java Programming...
# 2
> It should be String[] args, not String args[]Why would that make a difference? Of course it can be "String args[]."
BillKriegera at 2007-7-9 21:45:20 > top of Java-index,Java Essentials,Java Programming...
# 3
Makes no difference. How do you run your program? I bet it's not Main2 (or that version of it that you posted) you're executing.
CeciNEstPasUnProgrammeura at 2007-7-9 21:45:20 > top of Java-index,Java Essentials,Java Programming...
# 4

Looking at your code, I tried to look out for the Coin class in the Java's API, but

weren't able to find it, so that makes me wander about it, and maybe the

problem goes to the call, of the flip() method. which you invoke in the

Constructor of the MainClass_1.

As I don't know the implementation of Coin class, I can suppose the problem

could be running there.

Now, a good idea for you, could be that you use the Eclipse IDE

http://www.eclipse.org and use the debugger to trace your program execution and

see what is the method not found. (I repeat, I believe is the flip() method)

Hope this helps, cya around.

@lphazygmaa at 2007-7-9 21:45:20 > top of Java-index,Java Essentials,Java Programming...
# 5
very thanks to you, i've solved itthanks.. ;)
futia at 2007-7-9 21:45:20 > top of Java-index,Java Essentials,Java Programming...