ö·ʹ лѭҷԴ鹡Ѻ Constructor Ѻ
หน้า 1 จาก 1
ö·ʹ лѭҷԴ鹡Ѻ Constructor Ѻ
public class testExtend {
public static void main(String[] args) {
new child();
}
}
class parent{
parent(String para){
System.out.println("This is Parent :"+para);
}
// Constructor Ẻ仨ջѭ
parent(){
System.out.println("¡ super(); ¡Ѻ");
}
}
class child extends parent{
public child() {
//çѹ¡ super(); ը֧ Compile Error
System.out.println("This is Child");
}
}
public static void main(String[] args) {
new child();
}
}
class parent{
parent(String para){
System.out.println("This is Parent :"+para);
}
// Constructor Ẻ仨ջѭ
parent(){
System.out.println("¡ super(); ¡Ѻ");
}
}
class child extends parent{
public child() {
//çѹ¡ super(); ը֧ Compile Error
System.out.println("This is Child");
}
}
แก้ไขล่าสุดโดย Admin เมื่อ Mon May 19, 2008 8:27 pm, ทั้งหมด 1 ครั้ง
Re: ö·ʹ лѭҷԴ鹡Ѻ Constructor Ѻ
class child extends parent{
public child() {
this("ҷ");
System.out.println("This is Child");
}
public child(String A) {
this();
System.out.println("This is Child have Parameter"+A);
}
}
Ẻ Compile error recursive constructor invocation
public child() {
this("ҷ");
System.out.println("This is Child");
}
public child(String A) {
this();
System.out.println("This is Child have Parameter"+A);
}
}
Ẻ Compile error recursive constructor invocation
Re: ö·ʹ лѭҷԴ鹡Ѻ Constructor Ѻ
class child extends parent{
public child() {
// Ẻ ¡ 1 ҹ
super("ҡͺҹ");
this("ҷ");
System.out.println("This is Child");
}
public child(String A) {
//this();
super("ҡͺҹ");
System.out.println("This is Child have Parameter "+A);
}
}
public child() {
// Ẻ ¡ 1 ҹ
super("ҡͺҹ");
this("ҷ");
System.out.println("This is Child");
}
public child(String A) {
//this();
super("ҡͺҹ");
System.out.println("This is Child have Parameter "+A);
}
}
หน้า 1 จาก 1
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ