class student
{
int RollNo;
String name;
private int age;
public void setAge(int a)
{
if(a>=10&& a<=20)
age=a;
else
age=12;
}
public int GetAge()
{
return age;
}
}
class TestStudent
{
public static void main(String args[])
{
student s1=new student();
s1.setAge(200);
System.out.println("Age of the student"+s1.GetAge());
}
}
No comments:
Post a Comment