Reserved Keywords Flashcards
abstract
a non-access modifer. Used for classes and methods: an abstract class cannot be used to create objects -> (Must be inherited from another class). An abstract method can only be used in an abstract class, and it does not have a body. The body is provided by the subclass.
assert
For debugging -> used to verify that a certain assumption about the program is true. (assert (i == 0))
break
used to break out of a loop or switch block
case
Marks a block of code in switch statement
catch
Catches exceptions generated by try statements
class
Defines a class
continue
Continues to next iteration of a loop
final
Defines a constant -> value is non-changeable, impossible to inherit or override
default
Specifies the default block of code in a switch
statement
do
Used together with while to create a do-while loop
else
used in conditional statements
exports
Exports a package with a module
extends
Extend from parent class
finally
Used with exceptions, block of code that will be executed no matter if there is an exception or not
implements
implements an interface
import
used to import a package, class or interface
instanceof
Checks whether an object is an instance of a specific class or an interface
native
Specifies that a method is not implemented in the same Java source file (but in another language)
new
Creates new objects
module
Declares a module
package
declares a package (Basically a folder used to group classes)
private
access modifier used for attributes, methods and constructors, making them only accessible within the declared class
protected
an access modifier used for attributes methods and constructors, making them accessible in the same package and subclasses
public
access modifier used for classes, attributes, methods and constructors making them accessible by any other class