Java
DOCUMENTATION
Comments are used to document code so that other people reading the code can understand the logic.
PROGRAM ERRORS
Syntax errors are caused when the user writes code that is not understood by the compiler. A syntax error can be caused by incorrect capitalization or spelling mistakes. The compiler informs the user of a syntax error by displaying an error message. Typing “Public Class” instead of “public class” would result in a syntax error.
Run-time errors are caused by invalid data. Run-time errors do not effect thecompilation of your program thus the program will compile and execute, but it may crash or hang after execution. If you try to divide 12 by 0 you would get a run-time error because you cannot divide by 0.
Logic errors are caused by mistakes that do not defy the rules of the language and do not crash or hang the program, but instead yield incorrect results. The user may not understand the problem that the program is trying to solve and therefore uses the wrong equation, wrong strategy, etc. If you have an object move left instead of right, that is a logic error.
Comments are used to document code so that other people reading the code can understand the logic.
- Code: Select all
// Single Line Comment
- Code: Select all
/* Multi-Line
Comment */
/*********************
Multi-Line Comment
*********************/
PROGRAM ERRORS
Syntax errors are caused when the user writes code that is not understood by the compiler. A syntax error can be caused by incorrect capitalization or spelling mistakes. The compiler informs the user of a syntax error by displaying an error message. Typing “Public Class” instead of “public class” would result in a syntax error.
Run-time errors are caused by invalid data. Run-time errors do not effect thecompilation of your program thus the program will compile and execute, but it may crash or hang after execution. If you try to divide 12 by 0 you would get a run-time error because you cannot divide by 0.
Logic errors are caused by mistakes that do not defy the rules of the language and do not crash or hang the program, but instead yield incorrect results. The user may not understand the problem that the program is trying to solve and therefore uses the wrong equation, wrong strategy, etc. If you have an object move left instead of right, that is a logic error.