}的位置放错了。
public class ManKind
{
int sex;
int salary;
void manOrWoman(int sexValue)
{
switch (sexValue)
{
case 0:
System.out.println("a man");
break;
case 1:
System.out.println("a woman");
break;
default:
System.out.println("not a man or a woman");
}
}
void employed (int salaryValue)
{
if (salaryValue==0)
System.out.println("no job");
else
System.out.println("have job");
}
//} public static void main (String args[])
{
ManKind somePerson=new ManKind();
somePerson.sex=1;
somePerson.manOrWoman(someperson.sex);
somePerson.salary=5;
somePerson.employed(somePerson.salary);
try
{
System.in.read();
}
catch(Exception e)
{}
}} // ···
public class ManKind
{
int sex;
int salary;
void manOrWoman(int sexValue)
{
switch (sexValue)
{
case 0:
System.out.println("a man");
break;
case 1:
System.out.println("a woman");
break;
default:
System.out.println("not a man or a woman");
}
}
void employed (int salaryValue)
{
if (salaryValue==0)
System.out.println("no job");
else
System.out.println("have job");
}
//} public static void main (String args[])
{
ManKind somePerson=new ManKind();
somePerson.sex=1;
somePerson.manOrWoman(someperson.sex);
somePerson.salary=5;
somePerson.employed(somePerson.salary);
try
{
System.in.read();
}
catch(Exception e)
{}
}} // ···
你还要注意,
你的 CLASS NAME 和你的文件名是不是大小写一致的。
写匹配的。