Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Blue
- package lab.pkg3;
- public class Blue {
- public int x;
- public static int y = 10;
- {x =500;}
- {
- System.out.println(x);
- }
- public Blue(int x) {
- this.x = x;
- }
- public static void main(String[] args) { // Main Function
- Blue blue1 = new Blue(50);
- System.out.println(blue1.x + " " + blue1.y);
- blue1.y = 15;
- // System.out.println(Blue.y);
- Blue blue2 = new Blue(100);
- System.out.println(blue2.x + " " + blue2.y);
- }
- }
- //SuperHero
- package lab.pkg3;
- public class SuperHero {
- public String name, power;
- public SuperHero(String name, String power){
- this.name = name;
- this.power = power;
- }
- public void show(){
- System.out.println(name+ " "+power);
- //System.out.println(Blue.y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement