67,515
社区成员
发帖
与我相关
我的任务
分享
Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
//***为什么不能直接用getProperty来获取config.properties中的值? prop.getProperty(key)
Enumeration<String> en = (Enumeration<String>) prop.propertyNames();
String keyPassword = en.nextElement();
String valuePassword = prop.getProperty(keyPassword);
String keyUsername = en.nextElement();
String valueUsername = prop.getProperty(keyUsername);
Scanner sc = new Scanner(System.in);
System.out.println("---请输入修改的书籍号---");
while(true) {
//***int i = sc.nextInt();这里用nextInt()为什么下面的String s = sc.nextLine()获取的是空?
String str = sc.nextLine();
int i = Integer.parseInt(str);
if(i <= list.size()){
System.out.println(i + ":" + list.get(i-1));
System.out.println("---请输入修改后的图书名称---");
//***为什么会为空?
String s = sc.nextLine();
list.set(i - 1, s);
System.out.println("---修改完成,返回菜单页面---");
Menu.page();
break;
}
System.out.println("---请输入正确的书籍号---");
}