In the real word even if you are a experienced Java script programmer or a beginner your Java script will more than likely have a few errors in it. You would probably of missed a couple of semicolons or forgot to declare a variable. as we all know Java script can be tedious and time consuming if wrote from scratch, so you are bound to make a couple of errors on a script.
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 are illegal use of programming language rules, when the program compiler notices them it will show a 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 a error message for all of the errors. Once that error is fixed all of the following error message will be cleared.
Do not worry if you have created a Java script with syntax errors, it is very common and today even the best Java programmers are still missing them out here and there. The most important thing to no is how to fix them. Below you will find listed some of the common Java script errors made.
Java is case sensitive for example, Total is not the same as total
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 with out 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 a 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.