首页 > 编程语言 > 详细

Array数组基本案例:图书基本录入输出系统

时间:2016-11-16 13:40:22      阅读:113      评论:0      收藏:0      [点我收藏+]
 1 import java.util.Scanner;
 2 
 3 public class ArrayTest{
 4     public static void main(String args[]){
 5         Scanner sc = new Scanner(System.in);
 6         String[] book = new String[3];
 7         String[] bookNum = new String[3];
 8         int[] bookPrice = new int[3];
 9         for(int i = 0; i< book.length; i++){
10             System.out.println("请输入第"+(i+1) +"本书的书名:");
11             book[i] = sc.next();
12             System.out.println("请输入第"+(i+1) +"本书的编号:");
13             bookNum[i] = sc.next();
14             System.out.println("请输入第"+(i+1) +"本书的价格:");
15             bookPrice[i] = sc.nextInt();
16         }
17         System.out.print("书名\t编号\t价格\n");
18         for(int j = 0; j < book.length;j++){
19             System.out.print(book[j]+"\t"+bookNum[j]+"\t"+bookPrice[j]+"\n");
20         }
21         }
22     }    

 

Array数组基本案例:图书基本录入输出系统

原文:http://www.cnblogs.com/YangGC/p/6068903.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!