JAVA怎么按两个int型,一个double型的顺序从键盘输入三轮,存入文件中。
比如 1 2 3.0
4 5 6.0
7 8 9.0
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
Scanner scanner = new Scanner(System.in);
for (int i=0;i<3;i++){
Integer i1= scanner.nextInt();
Integer i2= scanner.nextInt();
Double i3= scanner.nextDouble();
System.out.println(i1+" "+i2+" "+i3);
}
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
for(int i=0;i<3;i++){
int a = scan.nextInt();
int b = scan.nextInt();
double d = scan.nextDouble();
System.out.println(a+","+b+","+d);
}
scan.close();
}
如有帮助望采纳
Scanner scanner = new Scanner(System.in);
for (int i=0;i<3;i++){
Integer integer1= scanner.nextInt();
Integer integer2= scanner.nextInt();
Double double1= scanner.nextDouble();
}