Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class program1
- {
- public static void main(String[] args)
- {
- program1_class2 object1 = new program1_class2(); //First object
- System.out.println(object1.myint += 1); //+ 1 to myint
- program1_class2 object2 = new program1_class2();
- System.out.println(object1.myint);
- /*
- * A static variable's value is shared among all objects of a class.
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement