救命!楼主的程序我改了一下,姓名显示不正常,高人帮我改改
import java.io.*;
class employee
{
private int salary;
private String name;
employee()
{
setname();
setsalary();
getname();
getsalary();
}
public void getsalary()
{
System.out.println("薪水");
System.out.println(salary);
}
public void getname()
{
System.out.println("姓名");
System.out.println(name);
}
public int setsalary()
{
System.out.println("输入薪水:");
BufferedReader ss = new BufferedReader(new InputStreamReader(System.in));
try
{
String s=ss.readLine();
salary = Integer.parseInt(s);
}
catch(IOException e)
{
System.out.println(e);
}
return salary;
}
public String setname()
{
System.out.println("输入姓名:");
BufferedReader sn = new BufferedReader(new InputStreamReader(System.in));//好像这一带
try
{
String name = sn.readLine();
}
catch(IOException e)
{
System.out.println(e);
}
return name;
}
}
public class em
{
public static void main(String argv[])
{
new employee();
}
}