JAVA Sheet
JAVA Sheet
VARIABLES STRINGS
[Regular Attributes & Methods] ; Note that we can catch different kinds of exceptions (at the
same time). We can add a finally statement that will be
[Abstract] [Return] name ([Type] name_arg) ; executed regardless of whether the exception has occurred
or not. We can throw our own custom exceptions:
}
class Exception_name extends Exception { }
Inside abstract classes we can declare abstract methods
(without body) that will be implemented by the subclasses. class name throws Exception_name {
Note that the subclasses must implement these methods.
[Block of Code to be executed] ;
INTERFACES
throw ( new Exception_name (message) ) ;
Completely abstract classes that can only contain abstract
}
methods (no constructor method) and final attributes. Note
that interfaces cannot be used to create objects. Interface
methods are by default abstract and public, while attributes
are by default public static and final.
interface Name_interface {
[Method Implementation] ;
EXCEPTIONS