Monday, December 12, 2016

Lets Start Programming A Simple Java Problem

        Here is the Code For a Simple Java Programme.😊😊😊



     And its all about from Java Static Methods and Variables.You can give the correct Answer for the given problem and Share knowledge too.. Submit your Answer in the comment Line. 

---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------



class MyClass{
int x;
static int y;
}
class Demo{
public static void main(String args[]){
MyClass c1=new MyClass();
c1.x=1;
c1.y=2;
MyClass c2=new MyClass();
c2.x=10;
c2.y=20;
MyClass c3=new MyClass();
c3.x=100;
c3.y=200;
System.out.println("c1 : "+c1.x+" "+c1.y);
System.out.println("c2 : "+c2.x+" "+c2.y);
System.out.println("c3 : "+c3.x+" "+c3.y);
}
}

Output : 

----------------------------------------------------------------------------------------------------------------------

0 comments:

Post a Comment