Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GenMethDemo {
- public static void main(String args[]) {
- Test trial = new Test();
- Test2 trial2 = new Test2();
- Test trial3 = new Test();
- System.out.println(trial.a == trial.b);
- System.out.println(trial.b == trial2.c); //Don't these point to different objects? Why is the result true?
- System.out.println(trial.a == trial3.a); //Don't these point to different objects? Why is the result true?
- System.out.println(trial.a);
- System.out.println(trial.b);
- }
- }
- class Test{
- int a = 5;
- int b = 5;
- }
- class Test2{
- int c = 5;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement