Advertisement
FahimFaisal

Untitled

Mar 22nd, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author acer
  4.  */
  5. public class ObjectTracing {
  6.     public static void main(String[] args) {
  7.        
  8.    
  9.      Human h1 = new Human();
  10.     Human h2 = new Human();
  11.     h1.age = 21;
  12.     h1.height = 5.5;
  13.     System.out.println(h1.age);
  14.     System.out.println(h1.height);
  15.     h2.height = h1.height - 3;
  16.     System.out.println(h2.height);
  17.     h2.age = h1.age++;
  18.     System.out.println(h1.age);
  19.         System.out.println("================");
  20.     h2 = h1;
  21.     System.out.println(h2.age);
  22.     System.out.println(h2.height);
  23.     h2.age++;
  24.     h2.height++;
  25.     System.out.println(h1.age);
  26.     System.out.println(h1.height);
  27.     h1.age = ++h2.age;
  28.     System.out.println(h2.age);
  29.     System.out.println(h2.height);    
  30.    
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement