thieumao

Student.java - Anh Kool

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