这应该是楼主想要的吧 !(有问题再Q我) int a[]=new int[10]; BufferedReader buf=new BufferedReader(new InputStreamReader(System.in)); /* 获取逗启数据给数陆丛组赋值 */ for(int n=0;n<早指樱a.length;n++) { System.out.print("输入第"+n+"个整数"); a[n]=Integer.parseInt(buf.readLine()); //将输入数字串转化为整数给 }
import java.util.Scanner; public class Student{ private String name; private int age; public Student(String name,int age){ this.name=name; this.age=age; } public void SayHi(){ System.out.println("我叫漏余 "+name+" 今年"+age+"岁"); }}public static void main(String args[]){ Student[] stus; Scanner input = new Scanner(System.in); System.out.print("请输入要创建的学生个数:"); int StuNum=input.nextInt(); stus=new Student[StuNum]; for(int i=0;i
import java.util.Scanner;
//public class test {
/滚轮/ private String name;
// private int age;
//桥弊 public test(){
//
// name = this.name;
// age = this.age;
// }
public static void main(String args[])
{
String a[] = new String [2];
Scanner scan = new Scanner(System.in);
a[0]=scan.next();
a[1]=scan.next();
System.out.println(a[0]+"敏备族,"+a[1]);
}}
可以用Scanner 方法 看看java的IO吧 必学的