本文实例为大家分享了java学生信息管理系统的具体代码,实现学生信息: 增加 int[] a=new int[9] 、删除 、查找、更改,供大家参考,具体内容如下
/*学生信息管理系统,实现学生信息:
*增加 int[] a=new int[9]
*删除
*查找
*更改
*/
import java.util.Scanner;//导入java输入流
import java.lang.*;
import java.io.*;
class Student
{
private static Student[] s=new Student[2];
int n=0;
private String name;
private int num;
private String classAge;
public void judge()throws IOException
{
int i;
char ch;
String str;
Scanner In=new Scanner(System.in);
if(n==0)
{
System.out.print("你还没有录入任何学生,是否录入(Y/N):");
str=In.next();
ch=str.charAt(0);
while(ch!='Y'&&ch!='y'&&ch!='N'&&ch!='n')
{
System.out.print("输入有误,请重新输入:");
str=In.next();
ch=str.charAt(0);
}
if(ch=='Y'||ch=='y')
{
this.add();
}
if(ch=='N'||ch=='n')
{
this.menu();
}
}
}
public void menu()throws IOException//定义菜单函数
{
int a;//定义switch语句变量
Scanner in=new Scanner(System.in);//实例化输入流对象
System.out.println("*********学生信息管理系统功能表*********");
System.out.println("***** 1.增加 *****");
System.out.println("***** 2.显示 *****");
System.out.println("***** 3.修改 *****");
System.out.println("***** 4.删除 *****");
System.out.println("***** 5.查看 *****");
System.out.println("***** 0.退出 *****");
System.out.println("****************************************");
System.out.print("请选择(0~5):");
a=in.nextInt();
while(a<0||a>5)
{
System.out.print("输入超出范围,请重新输入:");
a&