WentworthPeach
2016-10-30 16:47:32
這段代碼為何實(shí)現(xiàn)不了我想要的功能,求大神指點(diǎn)!
我想讓它實(shí)現(xiàn)的功能是:用戶輸入車牌號(hào),顯示密碼。
package?com.xiaohuangche;
import?java.util.Arrays;
import?java.util.Scanner;
import?java.util.ArrayList;
public?class?Yellow?{
//屬性(成員變量)有什么
static?int?number;
//輸入車牌號(hào)
void?search(){
???? System.out.println("請(qǐng)輸入小黃車的車牌號(hào)!");
???? Scanner?input=new?Scanner(System.in);
???? int?number=input.nextInt();
????}
/*??//??獲取密碼
????int?answer(){
???? int?password=0;
???? System.out.println("密碼為:"+password);
???? return?password;
????}*/
???public?static?void?main(String[]?args){
???Yellow?search=new?Yellow();???
???int[][]?bike={{12312,4580},{32034,1256},{32582,1236},{33856,1679}};
???for(int?i=0;i<bike.length;i++){
???for(int?j=0;j<bike[i].length;j++){
???if(number==bike[i][j]){
??System.out.println("密碼為:"+bike[i][j+1])?;
??Yellow.search();
???}
???else{
???System.out.println("對(duì)不起,目前無法找到該小黃車密碼!");
???}
???}
???}
???}
}
3 回答

添加回答
舉報(bào)
0/150
提交
取消