Created
February 25, 2014 04:35
-
-
Save sivabudh/9202766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyRobo { | |
int x = 5; | |
static int y = 6; | |
} | |
class Untitled { | |
public static void main(String[] args) { | |
MyRobo robo1 = new MyRobo(); | |
MyRobo robo2 = new MyRobo(); | |
robo1.x += 1; | |
robo2.x += 1; | |
System.out.println(robo1.x); | |
System.out.println(robo2.x); | |
robo1.y += 1; | |
robo2.y += 1; | |
System.out.println(robo1.y); | |
System.out.println(robo2.y); | |
MyRobo robo3 = new MyRobo(); | |
System.out.println(robo3.y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Printed output:
6
6
8
8
8