Results 1 to 5 of 5
  1. #1
    kashyapkeshav is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default EDITOR Doesnt contain main type error

    Hi ,
    Am new to JAVA ,am trying to execute the below program . But i encountered with the error "EDITOR Doesnt contain main type error " below is my program



    class deom{

    }

    public class B{
    public void main (String[] args){
    System.out.println(" main method strts");
    deom b1=new deom();
    System.out.println("b="+b1);
    System.out.println("=====using the stringf methd=========");
    String str =b1.toString();
    System.out.println("str="+str);
    }

    }

    IF I ADD THE STATIC Key word in the main method it works its looks very bizzare


    class deom{

    }

    public class B{
    public static void main (String[] args){
    System.out.println(" main method strts");
    deom b1=new deom();
    System.out.println("b="+b1);
    System.out.println("=====using the stringf methd=========");
    String str =b1.toString();
    System.out.println("str="+str);
    }

    }

    Java file name : B.java


    please help me to clear this mess

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,529
    Blog Entries
    7
    Rep Power
    20

    Default Re: EDITOR Doesnt contain main type error

    Your main( ... ) method should be a static method.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    kashyapkeshav is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: EDITOR Doesnt contain main type error

    you mean to say that main method cannot be Non static ?

    QUOTE=kashyapkeshav;300478]Hi ,
    Am new to JAVA ,am trying to execute the below program . But i encountered with the error "EDITOR Doesnt contain main type error " below is my program



    class deom{

    }

    public class B{
    public void main (String[] args){
    System.out.println(" main method strts");
    deom b1=new deom();
    System.out.println("b="+b1);
    System.out.println("=====using the stringf methd=========");
    String str =b1.toString();
    System.out.println("str="+str);
    }

    }

    IF I ADD THE STATIC Key word in the main method it works its looks very bizzare


    class deom{

    }

    public class B{
    public static void main (String[] args){
    System.out.println(" main method strts");
    deom b1=new deom();
    System.out.println("b="+b1);
    System.out.println("=====using the stringf methd=========");
    String str =b1.toString();
    System.out.println("str="+str);
    }

    }

    Java file name : B.java


    please help me to clear this mess[/QUOTE]

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: EDITOR Doesnt contain main type error

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,529
    Blog Entries
    7
    Rep Power
    20

    Default Re: EDITOR Doesnt contain main type error

    Quote Originally Posted by kashyapkeshav View Post
    you mean to say that main method cannot be Non static ?
    You can have a non-static main( ... ) method but it can't be used as a starting point of your program. The JVM only looks for a static main( ... ) method with the correct signature (i.e. a single String[] type parameter).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. editor does not contain a main type
    By gabriel in forum Eclipse
    Replies: 6
    Last Post: 01-22-2013, 09:00 PM
  2. Applet doesnt start or it doesnt show
    By 3dprogger in forum Java Applets
    Replies: 2
    Last Post: 01-07-2011, 07:03 PM
  3. Replies: 7
    Last Post: 09-28-2010, 12:17 AM
  4. Error Message:Editor does not contain main type
    By Deepa in forum New To Java
    Replies: 9
    Last Post: 07-03-2009, 03:58 AM
  5. Replies: 0
    Last Post: 11-27-2008, 12:25 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
  •