public class Student
{
private String name;
public Student(String s_name)    //1
{
name = s_name;      //2
}public static void main(String args[])
{
Student s = new Student();    //3
}
}

解决方案 »

  1.   

    第三行有错 你显示定义的构造函数有 一个参数 s_name当你显示定义构造函数后 就没有默认的构造函数了所以 Student s = new Student();    //3
    要改成 Student s = new Student("hello");    
     
      

  2.   

    你new student() 这里么有带参数,应该在构造函数中添加一个无参构造函数,或者在这里加参数。 new student("abc")
      

  3.   


    为啥hello不加引号会报错,字符串必须加引号吧?dos下运行不提示没加引号的错误。
      

  4.   

    Student s = new Student();    //3 
    没带参数。构造函数没法进行。