//Main Program
public class Sample {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i=200;
First Obj = new First(23);
boolean a = Obj instanceof First;
System.out.println("The value of a is " +a);
System.out.println("The value of i is " +i);
if(i==200)
{
System.out.println("The value is " +i);
}
else
{
System.out.println("The value is greater than (or) less than 200");
}
Obj.good();
}
}
//Constructor
public class First {
int age;
First(int age)
{
this.age=age;
System.out.println("The Age is " +age);
}
void good(){
System.out.println("Good");
}
}
Output:-
The Age is 23
The value of a is true
The value of i is 200
The value is 200
Good
No comments:
Post a Comment