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

Thread: I included the main method, but it keeps flashing that I don't have one included?

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I included the main method, but it keeps flashing that I don't have one included?

    package javaapplication11;


    if (taxRate > 0)
    public static void main (String [] args);

    {
    double taxAmount;
    taxAmount = subTotal * taxRate;
    total = subtotal + total;

    }


  2. #2
    Member
    Join Date
    May 2011
    Location
    west palm beach, FL
    Posts
    189
    My Mood
    Tired
    Thanks
    41
    Thanked 11 Times in 10 Posts

    Default Re: I included the main method, but it keeps flashing that I don't have one included?

    you should read through this Trail: Getting Started (The Java™ Tutorials)

  3. #3
    Junior Member
    Join Date
    Jul 2012
    Location
    Allahabad
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: I included the main method, but it keeps flashing that I don't have one included?

    Try to understand the main function is static and cannot be called but in main functions you can call functions and constructors.
    So,
    Try storing the code of main function in functions or constructors and then call it.

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: I included the main method, but it keeps flashing that I don't have one included?

    dannyboi
    This thread is just a new-code version of the same other three threads you created. I want you to know the rules on the forum are to help the people who answer questions. If you can not make it easy for us to help you for free, I have no time to help you.

  5. The Following User Says Thank You to jps For This Useful Post:

    copeg (July 23rd, 2012)

  6. #5
    Junior Member hackthisred's Avatar
    Join Date
    Apr 2012
    Posts
    18
    Thanks
    1
    Thanked 1 Time in 1 Post

    Lightbulb Re: I included the main method, but it keeps flashing that I don't have one included?

    ok... I'll answer the obvious... although I'm not sure what you are trying to accomplish your main method is wrong. Just remove the ';'
    public static void main(String[] args)
    {
       double taxAmount;
       taxAmount = subTotal * taxRate;
       total = subtotal + total;
    }
    You might want to revisit how mains are used to invoke an action, i.e. set your program in motion... it doesn't look like you quite have a handle on it just yet.
    f34r th3 kut3 1z

  7. #6
    Junior Member
    Join Date
    Jul 2012
    Location
    Canada
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: I included the main method, but it keeps flashing that I don't have one included?

    Quote Originally Posted by dannyboi View Post
    package javaapplication11;


    if (taxRate > 0)
    public static void main (String [] args);

    {
    double taxAmount;
    taxAmount = subTotal * taxRate;
    total = subtotal + total;

    }
    A main method ends with a curly brace, semicolons are used to set the end of a line .

Similar Threads

  1. [SOLVED] Printwriter class: displaying File contents to screen with included formatting?
    By mwebb in forum File I/O & Other I/O Streams
    Replies: 10
    Last Post: November 25th, 2011, 11:38 AM
  2. Replies: 3
    Last Post: October 31st, 2011, 12:42 AM
  3. How do I call a method from the main method?
    By JavaStudent1988 in forum Java Theory & Questions
    Replies: 5
    Last Post: October 19th, 2011, 08:37 PM
  4. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 10:01 AM
  5. JDBC code not included into JAR file??
    By friday in forum JDBC & Databases
    Replies: 4
    Last Post: December 17th, 2010, 12:32 PM

Tags for this Thread