import java.util.Scanner;
public class Person {
private String nama;
private String alamat;
private int umur;
public Person(String nma,String almt,int umr){
this. nama = nma;
this. alamat=almt;
this. umur= umr;
}
public void info() {
System.out.println ("Nama= "+this.nama);
System.out.println ("Alamat="+this. alamat);
System.out.println ("Umur="+this. umur);
}
public static void main (String args[]) {
Scanner masuk = new Scanner(System.in);
System.out.print ("Masukkan nama:");
String nm= masuk.nextLine();
System.out.print("Masukkan alamat:");
String alamat=masuk.nextLine();
System.out.print ("Masukan umur:");
int umur=masuk.nextInt();
Person oop= new Person (nm, alamat, umur);
oop.info();
}
}
Tidak ada komentar:
Posting Komentar