打开configuration选项--〉option--〉jdk tools——〉选择default选项——〉点击Edit
在这里面设置你所需要的

解决方案 »

  1.   


    public class P4-7
    { public static void main(String args[])
    {
    student student1=new student();
         student1.num="39";
         System.out.println("学号:"+togetnum());
         student1.grade="35班";
         System.out.println("班级:"+togetgrade());
         student1.sex="男";
         System.out.println("性别:"+togetsex());
         student1.age="19";
         System.out.println("年龄:"+togetage());
         student1.name=" 姚";
         System.out.println("姓名:"+togetname());
         int age1=student1.change(-1)
         System.out.println("修改后的年龄:"+age1)
    }
    }
          class student
     {
    String num,grade,sex,name;
    int age;
    String togetnum()
    {return num;}
    String togetgrade()
    {return grade;}
    String togetsex()
    {return sex;}
    int togetage()
    {return age;}
    String togetname()
    {return name;}
    int change(int age1)
    {return age+1;}

    }
    代码是上面这样的,
    --------------------Configuration: P4-7 - Java2SDK <Default>--------------------
    I:\Practice\P4-7\P4-7\P4-7.java:2: '{' expected
    public class P4-7
                   ^
    I:\Practice\P4-7\P4-7\P4-7.java:39: '}' expected
    }
     ^
    I:\Practice\P4-7\P4-7\P4-7.java:2: class P4 is public, should be declared in a file named P4.java
    public class P4-7
           ^
    3 errorsProcess completed.上面就是错误
    麻烦高手回复!!!!
      

  2.   

    1,public 类必须放置到文件名与该类类名相同的文件中,如 public class test 就必须方到test.java这个文件中.类名不支持 "-"吧是类名,改成其他的就ok了.如"p4"