(String[] args)
| 32 | */ |
| 33 | public class StudentDemo { |
| 34 | public static void main(String[] args) { |
| 35 | Student s1 = new Student("����ϼ", 28); |
| 36 | Student s2 = new Student("����ϼ", 28); |
| 37 | Student s3 = new Student("����ϼ", 29); |
| 38 | |
| 39 | // System.out.println(s1 == s1); |
| 40 | // System.out.println(s1 == s2); |
| 41 | System.out.println(s1.equals(s2)); |
| 42 | System.out.println(s1.equals(s3)); |
| 43 | System.out.println(s1.equals(s1)); |
| 44 | |
| 45 | Demo d = new Demo(); |
| 46 | System.out.println(s1.equals(d)); //ClassCastException |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | class Demo{} |