Results 1 to 2 of 2
  1. #1
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default [error] java.lang.NoSuchMethodError: main

    See anything wrong here?

    :confused:
    public class TestTwo {

    public void main(String[] args) {

    //WithdrawAmount(200);
    System.out.println(amount);
    }


    int amount = 1000;
    /*
    public void WithdrawAmount (int num) {

    synchronized(this) {

    if (num < this.amount) {
    this.amount -= num;
    }
    }

    }
    */

    }
    Runtime error:
    java.lang.NoSuchMethodError: main
    Exception in thread "main"

  2. #2
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    resolved my bug :)

    public static void main not public void main :)

Similar Threads

  1. Replies: 4
    Last Post: 10-09-2008, 06:08 PM
  2. NoSuchMethodError : Main (isn't that a blatant lie)
    By havfunonline in forum New To Java
    Replies: 8
    Last Post: 07-28-2008, 02:55 AM
  3. Replies: 1
    Last Post: 08-07-2007, 07:10 AM
  4. Replies: 1
    Last Post: 08-06-2007, 09:11 AM
  5. Replies: 1
    Last Post: 07-25-2007, 10:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •