Dru89

Main1.java

Feb 23rd, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. public class Main1 {
  2.  
  3.     /**
  4.      * @param args
  5.      */
  6.     public static void main(String[] args) {
  7.         MyClass myObjectA = new MyClass(3000);
  8.         MyClass myObjectB = new MyClass(2500);
  9.         System.out.println(myObjectA.myInt);
  10.         System.out.println(myObjectB.myInt);
  11.        
  12.         myObjectA.setMyLong(1000L);
  13.         myObjectB.setMyLong(4000L);
  14.         System.out.println(myObjectA.getMyLong());
  15.         System.out.println(myObjectB.getMyLong());
  16.        
  17.         System.out.println(myObjectB.classVariable);
  18.         myObjectA.classVariable = 3000;
  19.         System.out.println(myObjectB.classVariable);
  20.        
  21.         // Proper way to set class variables.
  22.         MyClass.classVariable = 1000;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment