import java.io.*;
class CPerson
{
  private String name;
  private String sex;
  private String bithnum;
  public void input() throws IOException
   {
     String na,se;
     BufferedReader buf;
     buf=new BufferedReader(new InputStreamReader(System.in));
     System.out.print("input the name:");
     na=buf.readLine();
     name=na;
     System.out.print("input the sex:");
     se=buf.readLine();
     sex=se;
   }
  public void inputbn() throws IOException
   {
     String bn;
     BufferedReader buf;
     buf=new BufferedReader(new InputStreamReader(System.in));
     System.out.print("input the number:");
     bn=buf.readLine();
     bithnum=bn;
   }
  public void output()
  {
   System.out.println("name="+name+",sex="+sex+",bithnum="+bithnum);
  }  public static void main(String args[]) throws IOException
  {
    CPerson per=new CPerson();
    per.input();
    per.inputbn();
    per.output();
  }
}

解决方案 »

  1.   

    你没有导包 还有就是一个类名写错了import java.io.*;
    class CPerson {
        private String name;
        private String sex;
        private String bithnum;
        public void input() throws IOException {
            String na, se;
            BufferedReader buf;
            buf = new BufferedReader(new InputStreamReader(System.in));
            System.out.print("input the name:");
            na = buf.readLine();
            name = na;
            System.out.print("input the sex:");
            se = buf.readLine();
            sex = se;
        }    public void inputbn() throws IOException {
            String bn;
            BufferedReader buf;
            buf = new BufferedReader(new InputStreamReader(System.in));
            System.out.print("input the number:");
            bn = buf.readLine();
            bithnum = bn;
        }    public void output() {
            System.out.println("name=" + name + ",sex=" + sex + ",bithnum=" +
                               bithnum);
        }
    }
    public class app8_5 {
        public static void main(String args[]) throws IOException {
            CPerson per = new CPerson();
            per.input();
            per.inputbn();
            per.output();
        }
    }
      

  2.   

    导入java.io.*这个包
    你原来的编的那个类名字不对,改成app8_5.java才能通过。
    上面的这个类名是CPerson.java也能通过