📄 student.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package Students;import java.io.*;/** * * @author liuwei */public class student { String idnum; String name; boolean sex; float height; float weight; float scores; public student() {idnum=""; name=""; sex=true; height=(float)0; weight=(float)0; scores=(float)0; int isex=0; try{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Input IDnum :"); idnum=in.readLine(); System.out.println("Input Name :"); name=in.readLine(); System.out.println("Input Sex(Male:1 Female:0) :"); // isex=(int)System.in.read(); isex=Integer.parseInt(in.readLine()); if(isex==1) sex=true; else sex=false; System.out.println("Input Height :"); height=Float.parseFloat(in.readLine()); System.out.println("Input Weight :"); weight=Float.parseFloat(in.readLine()); System.out.println("Input Scores :"); scores=Float.parseFloat(in.readLine()); }catch(IOException e){} } public void show() { System.out.println("Name:"+name+"\tID:"+idnum); if(sex==true) System.out.println("Sex:Male"); else System.out.println("Sex:Female"); System.out.println("Height:"+height+"\tWeight:"+weight); System.out.println("Scores:"+scores); } public static void main(String[] args) { int N =2; student[] sts=new student[N]; int i; for(i=0;i<N;i++) { System.out.println("***********Set a student's information:**********"); sts[i]=new student(); } for(i=0;i<N;i++) { System.out.println("*********The information of the student:*********"); sts[i].show(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -