Comments and Debugging Flashcards
used for a single line comment
//
used for a multiline comment
/* … */
used for documentation (JavaDoc)
/** … */
Comments are used to provide information on:
classes, methods, constructors, and more and often use the @ to tag stuff
Debugging is…
is the process of finding current and potential issues, then removing or resolving them
types of errors
syntax - code will not compile
runtime -code compiles and can create exceptions
logical - code runs but doesn’t do what is expected
what is an exception?
An exception is an event that happens while a program is running. It disrupts the normal flow of instructions.
NullPointerException is caused when…..
is caused when you attempt to use reference type objects before they are initialized.
ArrayIndexOutOfBoundsException is caused…..
is caused when you try to access an index of an Array that does not exist.
@param and @return are?
@param and @return are two commonly used Javadoc tags used in Java to document methods and functions.
The @param tag is used to…..
The @param tag is used to describe the parameters of a method or function. It is used to document what each parameter does, its data type, and any constraints or requirements that apply.
The @return tag is used to…..
The @return tag is used to describe the return value of a method or function. It is used to document what the method returns, its data type, and any constraints or requirements that apply.