| | |
illegal start of expression
![]() |
•
•
Join Date: Jan 2005
Posts: 5
Reputation:
Solved Threads: 0
I need some help with understanding an error that I am getting. Can anyone help me. Here is my problem. I am trying to hardcode information for a mortgage calc and I am getting an illegal start of expression error. Here is an example:
MortgageLoanCalculator.java:15: illegal start of expression
double interestRate = 5.7%; // Interest Rate = 5.75%
What does it mean?
MortgageLoanCalculator.java:15: illegal start of expression
double interestRate = 5.7%; // Interest Rate = 5.75%
What does it mean?
Can you post the previous few lines of the code ... the problem could be in the previous lines too ... look at them.
•
•
Join Date: Jan 2005
Posts: 5
Reputation:
Solved Threads: 0
Sure. Here is the program.
public class MortgageLoanCalculator
{
//Main method
public static void main(String [] args)
{
double interestRate = 5.7%; int numberOfYears = 30;
double loanAmount = %200,00;
//Enter monthly interest rate
System.out.println("The interest rate is:" + interestRate);
System.out.println("The loan amount is:" + loanAmount);
System.out.println("The term in years is:" + numberOfYears);
}
}
public class MortgageLoanCalculator
{
//Main method
public static void main(String [] args)
{
double interestRate = 5.7%; int numberOfYears = 30;
double loanAmount = %200,00;
//Enter monthly interest rate
System.out.println("The interest rate is:" + interestRate);
System.out.println("The loan amount is:" + loanAmount);
System.out.println("The term in years is:" + numberOfYears);
}
}
Try this out now
Java Syntax (Toggle Plain Text)
public class MortgageLoanCalculator { //Main method public static void main(String [] args) { double interestRate = 5.7; // you are defining a double value .. and % is not a double. int numberOfYears = 30; double loanAmount = 20000; //java doesnt recognize comas in doubles. //Enter monthly interest rate System.out.println("The interest rate is:" + interestRate); System.out.println("The loan amount is:" + loanAmount); System.out.println("The term in years is:" + numberOfYears); } }
![]() |
Similar Threads
- Illegal Start of Expression (Java)
- illegal start of expression (Java)
- JAVA Illegal Start of Expression Error (Java)
- Fibonacci Recursion - Illegal Start of expression! (Java)
- illegal start of expression (Java)
- Why illegal start of expression error? (Java)
Other Threads in the Java Forum
- Previous Thread: Centering
- Next Thread: Attributes
| Thread Tools | Search this Thread |
6 actuate android api applet application applications array arrays automation balls bank binary bluetooth bold business c++ chat class clear client code codesnippet collections component coordinates database defaultmethod development dice doctype dragging ebook eclipse educational error file formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide ideas image infinite ingres integer intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans openjavafx parameter php problem program programming project recursion repositories scanner scrollbar sell server set sms sort sorting sql sqlserver state storm string sun superclass swing swt threads tree websites windows






