class test
{
String Name=null;
int age;
String occupation=null;
public void set(String name,int age1,String occ)
{
Name=name;
age=age1;
occupation=occ;
}
public void get()
{
System.out.println("-------YOUR PERSONAL INFORMATION------");
System.out.println("NAME :"+Name);
System.out.println("AGE :"+age);
System.out.println("OCCUPATION :"+occupation);
}
}
public class EncapsulationExample extends test{
public static void main(String Dx[])
{
test t1=new test();
t1.set("Dx Panchal",23,"TRAINEE");
t1.get();
}
}
{
String Name=null;
int age;
String occupation=null;
public void set(String name,int age1,String occ)
{
Name=name;
age=age1;
occupation=occ;
}
public void get()
{
System.out.println("-------YOUR PERSONAL INFORMATION------");
System.out.println("NAME :"+Name);
System.out.println("AGE :"+age);
System.out.println("OCCUPATION :"+occupation);
}
}
public class EncapsulationExample extends test{
public static void main(String Dx[])
{
test t1=new test();
t1.set("Dx Panchal",23,"TRAINEE");
t1.get();
}
}
No comments:
Post a Comment