public class B extends A
| Class A | Class B |
|---|---|
| Base Class | Inherited Class |
| Base Class | Derived Class |
| Class | Subclass |
| Superclass | Class |
| Parent Class | Child Class |
Person
Employee
Executive
Vehicle
Automobile
StationWagon
DeliveryVehicle
Truck
Van
CelestialObject
FixedObject
Star
Nebula
Galaxy
DustCloud
OrbitingObject
Planet
Moon
Asteroid
Comet
Animal
Mammal
Cat
DomesticCat
Lion
Tiger
Rodent
Mole
Mouse
Rat
Insect
Ant
Fly
Wasp
MyFrame is a JFrame
Star is a FixedObject
Tiger is a Cat
ClassRoster has a Student
public Person(String aName, char aGender, int anAge)
System.out.println(45);
System.out.println("abc");
super("Jane", 'F', 34);
r = super.toString( ) + " " + salary;This call can be anywhere in any method of the derived class.
| Modifier | Accessibility | UML Symbol |
|---|---|---|
| public | Entire Project | + |
| private | Current Class | - |
| protected | Current Class or Derived Classes (Direct or Indirect) |
# |
Index 2
0 1 2
+---+---+---+
Index 0 | 4 | 5 | 2 |
1 +---+---+---+
1 | 9 | 8 | 3 |
+---+---+---+
// Method 1.
int[ ][ ] a;
a = new int[2][3];
a[0][0] = 4; a[0][1] = 5; a[0][2] = 2;
a[1][0] = 9; a[1][1] = 8; a[2][2] = 3;
// Method 2.
int[ ][ ] a = new int[2][3];
a[0][0] = 4; a[0][1] = 5; a[0][2] = 2;
a[1][0] = 9; a[1][1] = 8; a[2][2] = 3;
// Method 3.
int[ ][ ] a = { {4, 5, 2}, {9, 8, 3} };
public class Student
{
private String name;
private char gender;
private Address address;
private String[ ] classes;
}
An Address object is contained inside of the Student class.
public class Address
{
private String poBoxNumber;
private String apartment;
private String street;
private int buildingNumber;
private String city;
private String state;
private int zipCode;
}