•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 401,653 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,681 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 8957 | Replies: 5
![]() |
•
•
Join Date: Jan 2005
Posts: 5
Reputation:
Rep Power: 0
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:
Rep Power: 0
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);
}
}
•
•
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation:
Rep Power: 9
Solved Threads: 18
•
•
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation:
Rep Power: 9
Solved Threads: 18
Try this out now
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);
}
}![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- 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)
- Help on error message, illegal start an ';' expected (Java)
Other Threads in the Java Forum
- Previous Thread: Centering
- Next Thread: Attributes



Linear Mode