Java errors, just the same as any other programming errors can be set in two error fields.
- Syntax errors – also known as Compile errors
- Logical errors
Syntax errors are illegal use of programming language rules, when the program compiler notices them it will show an error message indicating the class details:
- Line number
- Where the error is found
- Type of error
this happens because one error may lead to another error message which confuses the system. If the error picked up is because of a missing semicolon it will cause the following one or more lines to become invalid. This will generate an error message for all of the errors. Once that error is fixed all of the following error messages will be cleared.
Java is case sensitive for example, Total is not the same as total
The file name is different than the public class name:
A Java file should not be saved in a file with exactly the same name, it should be saved in a file named. Java. For example car.java. saving the file in another way will cause a compiling error.
“Line nn: ‘;’ expected”:
This error means you wrote a new line without telling the compiler. When you code a line and it is too long to fit on a line, you will probably want to split the code into two lines. Doing this by only pressing the enter key will confuse the compiler, this will then generate an error message. Instead of using the enter key to split lines of code you will need to concatenate (forming two character strings) with a ‘+’ code symbol before adding the extra line of code.
For more information about our web design and marketing services then please call our office on 01743 367691 or alternatively you can complete our online enquiry form.