Advertisement
anhit92

Student

Jul 11th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. /*
  5.  * To change this template, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8. /**
  9.  *
  10.  * @author Anh-Kool
  11.  */
  12. public class Student {
  13.  
  14.     public String ten, tuoi, diachi;
  15.  
  16.     public Student() {
  17.     }
  18.  
  19.     public Student(String ten, String tuoi, String diachi) {
  20.         this.ten = ten;
  21.         this.tuoi = tuoi;
  22.         this.diachi = diachi;
  23.     }
  24.  
  25.     public String getTen() {
  26.         return ten;
  27.     }
  28.  
  29.     public void setTen(String ten) {
  30.         this.ten = ten;
  31.     }
  32.  
  33.     public String getTuoi() {
  34.         return tuoi;
  35.     }
  36.  
  37.     public void setTuoi(String tuoi) {
  38.         this.tuoi = tuoi;
  39.     }
  40.  
  41.     public String getDiachi() {
  42.         return diachi;
  43.     }
  44.  
  45.     public void setDiachi(String diachi) {
  46.         this.diachi = diachi;
  47.     }
  48.  
  49.     public void nhap() {
  50.         Scanner s;
  51.         System.out.print("Nhap ten: ");
  52.         s = new Scanner(System.in);
  53.         ten = s.nextLine();
  54.  
  55.         System.out.print("Nhap tuoi: ");
  56.         s = new Scanner(System.in);
  57.         tuoi = s.nextLine();
  58.  
  59.         System.out.print("Nhap dia chi: ");
  60.         s = new Scanner(System.in);
  61.         diachi = s.nextLine();
  62.  
  63.     }
  64.  
  65.     public void hienthi() {
  66.         System.out.println("Ten: " + ten);
  67.         System.out.println("Tuoi: " + tuoi);
  68.         System.out.println("Dia chi: " + diachi);
  69.  
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement