Debugging: Finding errors

Syntax errors are usually pointed out by the compiler when you try to run it. The message displayed can vary from one compiler to another. The best way to learn about the types of error message that can occur is to take a working program and "break it", create an error. Then run it to see what error message you get.

1
2
3
4
5
6
7
8
// your name
// my first program
package helloworld;
public class Hello {
	public static void main(String[] args) {
		System.out.println("Hello World");
	}//main
}//package
CODE

For instance, you might leave out the line that says "using namespace std;". The picture below shows the error messges.cout unknown

Usually, you can click on the error message to highlight the error in the code.

NEXT: