π μμμ΄λ?
μ΄λ€ ν΄λμ€μ λͺ¨λ λ΄μ©μ μ¬μ©νμ¬, μλ‘μ΄ ν΄λμ€λ₯Ό λ§λλ κ²
π μμνκΈ°
class Parents {
String firstName;
String lastName;
int age;
void sayHello() {
System.out.println("Hello");
}
}
// Parents ν΄λμ€ μμ!
class Child extends Parents {
}
public class Main {
public static void main(String[] args){
// Child κ°μ²΄ μμ±
Child child = new Child();
// Child κ°μ²΄μμ, Parents κ°μ²΄μ λ©€λ²λ³μ or λ©μλ μ¬μ©κ°λ₯!
child.sayHello();
child.lastName = "μ§νΈ"
}
}
λ°μν