itec30 Flashcards
It enables you to define superclass and subclasses.
inheritance
This method returns a string representation of the object.
toString()
It is a type that defined by a subclass.
subtype
It is a type that defined by a superclass
Supertype
It means that a variable of a supertype can refer to a subtype object.
polymorphism
It can also be used to convert an object of one class to another within an inheritance hierarchy.
casting
It can be used to test whether an object is an instance of a class.
instance of operator
It is another method that defined in the object class that often used.
equal method
It is a modifier can be applied on a data and methods in a class.
protected modifier
It is a modifier that indicates that a class is cannot be a parent class
final modifier
It is an object that represents an error or a condition that prevents execution from proceeding normally.
exception
It is thrown if you access an object through a reference variable before an object is assigned to it.
NullPointerException
It is thrown if you access an element in array outside the bounds of array.
IndexOutOfBoundsException
Every method must state the types of checked exceptions it might throw
declaring exceptions
When the program detects an error, the program can create an instance of an appropriate exception type and throw it.
throwing exception / throwing an exception
It is declared using the new Java keyword assert in JDK 1.4
assertion
It is intended to provide an abstraction that deals with most of machine-dependent complexities of files a path names in a machine independent fashion.
file class
directory separator for windows
backslash
java directory separator
forward slash
it is in relation to the current working directory
relative file name
Modifier on members in a class
- Public
- Default
- Protected
- Private
Final modifier characteristics
- The final class cannot be extended
- The final variable is a constant
- The final method cannot be overridden by its subclass
Runtime Exception, Error and their subclasses are known as
Unchecked exceptions
_______checked at compile
time.
checked exceptions
An assertion contains a __________ that should be true during program execution
boolean expression
____ is a new Java keyword introduced
in JDK 1.4, you have to compile the program
using a JDK 1.4 compiler.
assert
filename is a ____
string
______ contains a file name with its path and drive letter.
absolute filename
In order to perform I/O, you need to create objects using appropriate
java i/o classes
absolute filename maybe home/liang/book/welcome java
UNIX platform
the file class is a ____ for the file name and its directory path
wrapper class
_____ are thrown by JVM and represented in the error class
system errors
Every class in Java is descended from the java.lang.Object class. T or F
true
The Object class is the parent class of all the classes in java by default. T or F
true
Polymorphism occurs when a program invokes a method through a superclass variable. T or F
true
Explicit casting must be used when casting an object from a superclass to a subclass. T or F
true
The Math class is a final class. T or F
true
A subclass inherits methods from a superclass. Sometimes it is necessary for the subclass to modify the implementation of a method defined in the superclass. This is referred to as method overriding T or F
true
To override a method, the method must be defined in the subclass using the same signature and the same return type as in its superclass. T or F
true
Like an instance method, a static method can be inherited. However, a static method cannot be overridden. T or F
true
If a static method defined in the superclass is redefined in a subclass, the method defined in the superclass. T or F
true
Java do not require that the statement that uses the keyword super appear first in the constructor. T or F
false
Runtime errors occur while a program is running if the JVM detects an operation that is impossible to carry out. T or F
true
If the exception is handled, the program will terminate abnormally. T or F
false
The exception is an object created from an exception class. T or F
ttrue
The constructor ArithmethicException(int) is invoked to construct an exception object, where int is a message that describes the exception. T or F
false
The try block contains the code that is executed in normal circumstances. T or F
true
The exception is caught by the fetch block to handle the exception. T or F
false
The root class for exceptions is java.lang.Throwable. T or F
true
You can create your own exception classes by extending Exception or a subclass of Exception. T or F
false
Exception describes errors caused by your program and external circumstances. T or F
true
All other exceptions are known as error exceptions. T or F
false