Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: i dont know why i cant see the output nor enter input

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default i dont know why i cant see the output nor enter input

    hello,

    when i compile, there is no error. however when i run it, it shows this message


    "Exception in thred "main" java.lang.NoSuchMethodError: main
    Press any key to continue..." any idea?

    my program is related to polymorphism via inheritance.
    which separate into 2 files, StaffMember.java & human.java

    the Volunteer progrom allows user to enter their details and it will link and display according to the program in StaffMember class.

    below are my code:

    //StaffMember.java
    import java.util.*;
    import java.text.*;
    public class StaffMember
    {
    protected String name;
    protected String address;
    protected String phone;
     
    public Staffmember(String eName,String eAddress,String ePhone)
    {name=eName;
    address=eAddress;
    phone=ePhone;}
     
    public String toString()
    {
    String result="Name :" +name+"\n";
    result+="Address:"+address+"\n";
    result+="Phone:"+phone;
    return result;
    }
     
     
    //human.java
    import java.util.*;
    import java.text.*;
    public class human extends Staffmember
    {
    public human(String eName,String eAddress, String ePhone)
    {
    super(eName,eAddress,ePhone);
    }
     
    }

    the software im using is jcreator, however i not manage to display nor enter details, its only show "Exception in thred "main" java.lang.NoSuchMethodError: main
    Press any key to continue..."
    Last edited by KevinWorkman; June 1st, 2011 at 08:48 AM. Reason: added highlight tags


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: i dont know why i cant see the output nor enter input

    The problem is pretty much self-explanatory- you don't have a main method. Applications need a main method to run. You can't run something as an application without a main method.

    PS- When posting code, make sure you use highlight tags to preserve formatting. I've added them for you this time. You should also use standard naming conventions (variables and methods are lower-case, classes are upper-case), to make it easier for people to help you.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: i dont know why i cant see the output nor enter input

    Check out the Java Tutorial - 'Getting Started'.

Similar Threads

  1. [SOLVED] Need help with input/output error
    By stefan2892 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 7th, 2011, 10:44 AM
  2. command prompt, acquiring input without enter?
    By kitube in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: January 24th, 2011, 10:14 PM
  3. [SOLVED] T_T [hellllppppp] Input/Output
    By bontet in forum File I/O & Other I/O Streams
    Replies: 9
    Last Post: October 29th, 2010, 11:32 AM
  4. Input/Output file help
    By Plural in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 25th, 2010, 08:34 PM
  5. Input/Output file help
    By Plural in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 23rd, 2010, 06:26 PM