今天复习后所输入的代码.
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("请输入数字1~9(输入0结束):");
int i=input.nextInt();
while(i!=0){
switch(i){
case 1:
System.out.println("今天是:MON");
break;
case 2:
System.out.println("今天是:TUE");
break;
case 3:
System.out.println("今天是:WED");
break;
case 4:
System.out.println("今天是:THD");
break;
case 5:
System.out.println("今天是:FRI");
break;
case 6:
System.out.println("今天是:SAT");
break;
case 7:
System.out.println("今天是:SUN");
break;
case 8:
System.out.println("今天是:Eight");
break;
case 9:
System.out.println("今天是:Nine");
break;
default:
System.out.println("输入错误,请重新输入。");
}
System.out.println("请输入数字1~9(输入0时结束:)");
i=input.nextInt();
}
System.out.println("结束");
}
}
class Show1{
String s1=null;
String s2=null;
String s3=null;
}
public class ketang2 {
public static void main(String[] args) {
Show1 s=new Show1();
Scanner input=new Scanner (System.in);
System.out.println("请输入身份证号:");
s.s1=input.next();
System.out.println("请输入手机号:");
s.s2=input.next();
System.out.println("请输入座机号:");
s.s3=input.next();
if(s.s1.length()>=16&&s.s1.length()<=19){
System.out.println("输入成功!");
}else{
System.out.println("身份证号码必须是16位或者18位!");
}if(s.s2.length()==11){
System.out.println("输入成功!");
}else{
System.out.println("手机号码必须是11位数!");
}if((s.s3.length()<4)&&(s.s3.length()<7)){
System.out.println("输入成功!");
}else{
System.out.println("座机号码区域号必须为4位,电话号必须为7位!");
}
}
}
public class zuoye2 {
public static void main(String[] args) {
Scanner input=new Scanner (System.in);
String a;
int b;
String c;
String d;
System.out.println("请输入学生姓名:");
a=input.next();
System.out.println("请输入学生年龄:");
b=input.nextInt();
System.out.println("请输入学生性别:");
c=input.next();
System.out.println("请输入学校:");
d=input.next();
System.out.println("将该学生信息成功写入数据库:");
if(a.contains(a)){
System.out.println("姓名:"+a);
}if(b==b){
System.out.println("年龄:"+b);
}if(c.contains(c)){
System.out.println("性别:"+c);
}if(d.contains(d)){
System.out.println("学校:"+d);
}
}
}