日期:2014-05-20  浏览次数:20698 次

初学 求助 问个概念。。
super() 只能写在子类的构造函数中的第一行,只起到调用父类构造函数的作用,也只能给父类构造函数传递参数。 这样说 对吧???

------解决方案--------------------
这一点JDK文档有说明:

Invocation of a superclass constructor must be the first line in the subclass constructor.

The syntax for calling a superclass constructor is

super();
--or--
super(parameter list);

With super(), the superclass no-argument constructor is called. With super(parameter list), the superclass constructor with a matching parameter list is called.