public class Main{
//Method
public static int getSum(int x, int y){
return x + y;
}
public static void main(String[] args) {
//Driver for the Object
Person person = new Person();
person.setPerson("Arcturus", "Male", "Single", 21);
person.print();
System.out.println();
//Driver for the Method
System.out.println(getSum(5,3));
}
}
//Object
class Person {
String name, gender, marital_status;
int age;
public Person(){
this.name = "";
this.gender = "";
this.marital_status = "";
}
public void setPerson(String name, String gender, String marital_status, int age){
this.name = name;
this.gender = gender;
this.marital_status = marital_status;
this.age = age;
}
public void print(){
System.out.printf("Name: %s%nGender: %s%nMarital Status: %s%nAge: %d",this.name, this.gender, this.marital_status, this.age);
}
}