我想將值從 a 推Scanner送到 an Array。我想知道這段代碼是否正確。如果錯了怎么辦?這是我一遍遍呼叫的方法。所以我想將該用戶輸入值存盤在Array.
String[] student_id = new String[150];
String studentId = "";
System.out.print("Enter Student ID : ");
studentId = input.nextLine();
student_id = studentId;
for(int i =0;i<student_id.length;i ) {
student_id[i] = input.nextLine();
}
uj5u.com熱心網友回復:
簡單
String[] student_id=new String[150];
System.out.print("Enter Student ID : ");
for(int i =0;i<student_id.length;i ){
student_id[i] = input.nextLine();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/311123.html
上一篇:對隱藏欄位發出警告的Java規則
下一篇:無法為公共抽象org.springframework.data.domain.Pagecom.example.repository.DocumentsRepository.findBytypeid創建
