一、构建方法
(1)题目
(2)源代码

import java.util.Scanner; public class test { public static void main(String[] args) { Foo obj1=new Foo(); } } class Foo{ int value; Foo(int Initvalue) { value=Initvalue; } }

import java.util.Scanner; public class test { public static void main(String[] args) { Foo obj1=new Foo(); } } class Foo{ int value; Foo(int Initvalue) { value=Initvalue; } Foo() { value=100; } }
(3)分析
如果一个类没有构造方法就默认继承object里的构造方法,但是如果一个类提供了自定义的构造方法将导致系统不再提供默认的构造方法。