package com.constructor; public class Student { //无参数构造器 public Student(){ System.out.println("无参数"); } //有参数构造器 public Student(String name,double score){ System.out.println("有参数"); } }
package com.constructor; public class Test { public static void main(String[] args) { Student s=new Student(); Student s1=new Student("波仔",99); } }
标签:System,构造,参数,Student,public,out From: https://www.cnblogs.com/Karl-hut/p/17437958.html