forked from rjhoyle/cs151
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
37 lines (29 loc) · 676 Bytes
/
Copy pathStudent.java
File metadata and controls
37 lines (29 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/** A student
*
* @author rhoyle
*
*/
public class Student extends Person {
private int year;
/** Constructor
*
* @param fname String First Name
* @param lname String Last Name
* @param year int Year of Graduation
*/
public Student(String fname, String lname, int year) {
super(fname, lname);
this.year = year;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Student s1 = new Student("Bob", "Geitz", 1975);
Person p1 = new Person("Roberto", "Hoyle");
if (s1.equals(p1)) {
System.out.println("s1 equals p1");
}
if (s1 instanceof Person) {
System.out.println("Students are people too!");
}
}
}