来自另一个的Java One构造函数


来自另一个的Java One构造函数

public class Sample {

   int num;

   public Sample() {

      System.out.println("This is default constructor");

       num = 30;

   }

   public Sample(int value) {

      this();

      System.out.println("This is parameterized constructor");

      num = value;

   }

   public static void main(String args[]){

      Sample s = new Sample(30);

   }

}