-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathOOP.java
More file actions
33 lines (22 loc) · 884 Bytes
/
OOP.java
File metadata and controls
33 lines (22 loc) · 884 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
package edu.najah.cap.classes;
public class OOP {
public static void main(String[] args) {
Student s1 = new Student("Student 1");
Student s2 = new Student("Student 1");
System.out.println(s1.getName());
System.out.println(s2.getName());
Object obj = new Student("Student 222");
Student s4 = (Student) obj;
System.out.println(s4.getName());
System.out.println("== " + (s1 == s2));//will return false
System.out.println("equals?? " + s1.equals("s4"));
System.out.println(s2.getClass().getName());
// will print true or false
// equals function where did it come from?
User user = new User(1, "assaf", "123");
System.out.println(user.id);
System.out.println(user.username);
user.sayHello();
//System.out.println(user.password);
}
}