/**
*
*/
/**
* @author U0123154
*
*/
public class Inst {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Demo obj1 = new Demo();
Demo obj2 = new Demo();
obj1.i++;
obj2.i--;
obj1.display();
obj2.display();
}
}
*
*/
/**
* @author U0123154
*
*/
public class Inst {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Demo obj1 = new Demo();
Demo obj2 = new Demo();
obj1.i++;
obj2.i--;
obj1.display();
obj2.display();
}
}
public class Demo {
public int i=10;
void display(){
System.out.println("The value of i is " +i);
}
}
Output:-
The value of i is 11
The value of i is 9
No comments:
Post a Comment