首页 > IT职业 > IT图书 > java里的this和super
在重写一个类的时候,this()里面传参数代表调用构造函数。this.什么代表调用属性或者方法。super()还有super.都是父类的实现。
public class MysimpleDateFormat extends SimpleDateFormat {
public MysimpleDateFormat() { this("yyyy-MM-dd hh:mm:ss");}public MysimpleDateFormat(String arg0) { super(arg0);}public MysimpleDateFormat(String arg0, Locale arg1) { super(arg0, arg1);}public MysimpleDateFormat(String arg0, DateFormatSymbols arg1) { super(arg0, arg1);}
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1627/viewspace-2813313/ ,如需转载,请注明出处,否则将追究法律责任。