JAva:list学生管理クラスの実装


       ,        ,       

         ,         (util   List),      
    Collection      ,    、  、  、                ,

  
           
        
       
          
          
 
  
 
  
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Stu {

	public static class Student
	{
		private  String name;
		private  int number;
		private  String sex;
		public   void set(String na ,int num,String s)  //     

		{
			name=na;
			number=num;
			sex=s;
		}
		public  void setNumber(int num)
		{
			 number=num;
		}
		public  void setName(String nam)
		{
			 name=nam;
		}
		public  void setSex(String se)
		{
			 sex=se;
		}

		
		
		public  int getNumber()
		{
			return number;
		}
		public  String getName()
		{
			return name;
		}
		public  String getSex()
		{
			return sex;
		}
	}
	public static class Deal
	{
		static List stu;

		void show(Student s) //      
		{

			System.out.println("     :"+s.getNumber());
			System.out.println("     :"+s.getName());
			System.out.println("     :"+s.getSex());
		}
		void add(String na ,int num,String s)  //      
		{
			Student stud=new Student();
			stud.set(na, num, s);
			stu.add(stud);
			System.out.println("    !");
		}
		void delete(int num)   //      
		{
			for(int loop=0;loop();
		d.add("Yu",12323," ");
		d.show(d.search(12323));
		e.add("Ya",12322," ");
		d.show(d.search(12322));
		d.update(12322);
		d.show(d.search(12313));
	}

}