Post date: Apr 10, 2014 11:05:23 AM
package studenttest;
public class Student
{
private String name,address;
private int age;
void Set_Name(String n)
{
name=n;
}
void Set_Address(String s)
{
address=s;
}
void Set_Age(int a)
{
age=a;
}
String Get_Name()
{
return name;
}
String Get_Address()
{
return address;
}
int Get_Age()
{
return age;
}
}
package studenttest;
public class StudentTest
{
public static void main(String[] args)
{
Student std1=new Student();
Student std2=new Student();
std1.Set_Name("ali");
std1.Set_Address("duhok");
std1.Set_Age(18);
std2.Set_Name("salem");
std2.Set_Address("zakho");
std2.Set_Age(25);
System.out.println("The information about std1 :");
System.out.println("The name : "+std1.Get_Name());
System.out.println("The address : "+std1.Get_Address());
System.out.println("The age : "+std1.Get_Age());
System.out.println("\n\nThe information about std2 :");
System.out.println("The name : "+std2.Get_Name());
System.out.println("The address : "+std2.Get_Address());
System.out.println("The age : "+std2.Get_Age());
}
}