import javax.swing.JOptionPane;

publicclassGuessBirthday{publicstaticvoidmain(String[]args){Stringset1="1357\n"+"9111... public class GuessBirthday{
public static void main(String[] args){
String set1 = "1 3 5 7\n" + "9 11 13 15\n" + "17 19 21 23\n" + "25 27 29 31";
String set2 = "2 3 6 7\n" + "10 11 14 15\n" + "18 19 22 23\n" + "26 27 30 31";
String set3 = "4 5 6 7\n" + "12 13 14 15\n" + "20 21 22 23\n" + "28 29 30 31";
String set4 = "8 9 10 11\n" + "12 13 14 15\n" + "24 25 26 27\n" + "28 29 30 31";
String set5 = "16 17 18 19\n" + "20 21 22 23\n" + "24 25 26 27\n" + "28 29 30 31";

int day = 0;

String yourBirthday = "Is your birthday in Set1\n" ;
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 1;

String yourBirthday = "Is your birthday in Set2\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour= Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 2;

String yourBirthday = "Is your birthday in Set3\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 4;

String yourBirthday = "Is your birthday in Set4\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 8;

String yourBirthday = "Is your birthday in Set5\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 16;

String birthday = "你的生日是:" + day + "号!";
JOptionPane.showMessageDialog(null,birthday);

}
}
哪位大神帮忙看以这个错在哪了,编译的时候提示:已在方法main(String[])定义了birthday、yourbirthday、numberOfYour.numberYour、,急急急!!!
展开
 我来答
wh猎人
2015-04-11 · TA获得超过1125个赞
知道大有可为答主
回答量:1157
采纳率:89%
帮助的人:659万
展开全部
已经告诉你错在哪里了呀:已在方法main(String[])定义了birthday、yourbirthday、numberOfYour.numberYour。
java中每个变量只能定义一次,所以后面的birthday、yourbirthday、numberOfYour.numberYour等不需要再定义了,即去掉变量前的类型声明。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式