This discussion is archived
5 Replies Latest reply: Feb 23, 2007 12:08 PM by 807606 RSS

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

807606 Newbie
Currently Being Moderated
When I run mainClass , this error appears.
java.lang.NoSuchMethodError: main Exception in thread "main"
===============================
my main class
public class Main2 {

     public static void main(String args[])
     {
          MainClass_1 a = new MainClass_1();
          a.yaz();
     }
}
===

MainClass_1 =>
public class 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();
          }
          public void 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
public class MonetaryCoin extends Coin {
     private int value = 0;
     public MonetaryCoin() {     }
     public void setValue(int value)
     {
     this.value = value;
     }
     public int getValue()
     {
          return value;
     }
}
the coin class has already worked.
thanks ..

null