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;
}
Re: I included the main method, but it keeps flashing that I don't have one included?
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.
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.
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 ';'
Code java:
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.
Re: I included the main method, but it keeps flashing that I don't have one included?
Quote:
Originally Posted by
dannyboi
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 ;).