帮我看看那里错了 初学者

import java.util.*;

public class feng{

public static vold main(String[]args){

Scanner in=new Scanner(System.in);

System.out.println("请输入一个整数");

int one=in.nextInt();

if(one==0){

System.out.print("生成了一只白猪");

}else if(one==1){

System.out.print("生成一只黑猪");

}else if(one==2){

System.out.println("生成一只红猪");

}else{

System.out.println("生成了一只变形猪");

}

}

}


qq_风希_0
浏览 1259回答 3
3回答

yanrun

第一是void而不是vold,第二,你的System.out.println("请输入一个整数");里的)是中文的应该改成英文的,第三,scanner用完要关闭,可以在int one = in.nextInt();后调用in.close();

慕的地8582982

UQJAMGNVROIZFSCCMCIIJJVYVFFFCZAUBCNFCFSNGWFJBUASWPMFOPPIEYKOXNUQKULEEERIVKNWGTGFDGGQNJDUJFFISMPAPWRPIVYCVLVRELFLUYSFSYBROCBXPMQQMFWZRKDAJYYCBBSCEUXBLGDRUEHDTQTWTWLVFMJZPZKTWLBEHDFIYUKOPTJTPZPMHEUCTKDSCTQUQFOLVAWYVKAJNQSPJLODTVFCEBFRAKMQTVRTCZXTXNXNDZBMPTVYIRCEBYOYRNQNXGPMBGPMCMCSUYNJMWMCLUYNWMHXHBKUECLOETKHGCFWZJFPFHDEGWZIEHKADMWXNQZCMORUQTKZJACFBRVZQFBZPFPYUSGPSBKHKTXLJTMOLICYVLALUUDADZPRGDTCNQSIYAEVEAKBRGBRVZBKORAEBUCWTGJCPEXRYYSTMDVZQQJCWZGRKARRQULLVOLRYROUIRYSLREIVTJVPVVPIBPFWPFVJKDRXKQVMYOUVMEQOSYCCQQQTAQULUDXAEYMLBREDUTXLUBFEYMVBOVISQACGSJFSDKNKDLZABOIELBCNPOSPLYIMJNGGAIHTAQPPJMCGHBIVOIAZZIMDBFSAVPCDPTKPCYISSLVEIYQDKKEMKHTUTTWTROJNGGHLOOHZPPZDGKNIZSQHIYRREDMRYBBJPMWGDRRURELUBLIPHOYFVFFQZJNCYLZMPXIHFLVOIFWKEFYSIRKONQEHRACYFSPPPCNVOROPFYPDKUXHROUNQJWUMQJQIORMCKDESOSXADNEOVSMJRQIFLBSICQZWGQMMEKPHUUEVVRRSXUHUQEFSLYVMCALYNESOXBHWPUBMWIILLIYWATKBHEEFVZSMZQUIBEIYTJSCCJ

qq_风希_0

System.out.println("请输入一个整数");  我运行说我这里非法字符  应该怎么修改  谢谢
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java