eProgrammingLab

Java


Java Requirements: Threes in Java
1. Expressions are made up of: Variables
Operators
Literals
Method calls
2. Three rules for overloaded methods: They must have the same name
They must be in the same class
They must have different signatures (headers)
3. Three rules for overridden methods: They must have the same name
They must have the same signature (headers)
They must be in different classes
4. Three rules for constructors: The must have the name of the class in which they are contained
The do not have a return type
They are typically overloaded
5. Three uses of square brackets: Used to declare an array
Used to instantiate an array
Used to reference an element of an array
6. Three uses of final: Variables: create constants: public static final float PI = 3.14159f;
Methods: prevents the method from being overridden in a subclass
Classes: prevents the class from being extended.
7. Three uses of super: Use to call a base class constructor
Use to call a base class method that has been overridden.
Use to reference a base class variable (shadow variables)
8. Three requirements for polymorphism: There must be an inheritance hierarchy
There must be overridden methods
There must be a base class reference variable
9. Abstract classes may have: Any number of fully implemented methods (zero or more)
Any mixture of fully implemented and abstract methods
Any number of constructors
Any number of instance variables
Any number of abstract methods (zero or more)
10. Interfaces may have: Any number of method headers (public)
Any number of constant definitions (public static final)
Any mixture of methods headers and constants.