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 4 of 4

Thread: having trouble with my code

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default having trouble with my code

    I'm a huge beginner to java and this website. I'm using eclipse for this small bit of code, and I keep getting this output:

    "Error: Main method not found in class HelloWorld, please define the main method as:
    public static void main(String[] args)
    or a JavaFX application class must extend javafx.application.Application"

    I'm trying to get better with variables, but the only function it works on is public static void main(String[] args) and I don't know why


    public class HelloWorld{
    void assignVar() {
    String wow = new String("hi!");
    System.out.println(wow);
    }
    }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: having trouble with my code


  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: having trouble with my code

    ty

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: having trouble with my code

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags which are explained near the above link.

Similar Threads

  1. Trouble Porting my Java File Reading Code to Android Code
    By Gravity Games in forum Android Development
    Replies: 0
    Last Post: December 6th, 2012, 04:38 PM
  2. Trouble getting zip file code to work??
    By monoposto in forum Object Oriented Programming
    Replies: 0
    Last Post: July 16th, 2012, 07:26 PM
  3. Having Trouble Modify the code!!
    By jehov86 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 2nd, 2012, 09:42 AM
  4. Beginner having some trouble with two parts in my code
    By csprung in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 25th, 2012, 04:23 AM
  5. Trouble writing some code...help?
    By bChEos in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: February 7th, 2010, 08:54 PM