๋ชฉ์ฐจ
๋ถ๋ชจ ํด๋์ค
package extends1.ex2;
public class Parent {
public void income() {
System.out.println("์์ธ๋ฅผ 10,000,000์ ๋ฐ์ต๋๋ค.");
}
}
์์ ํด๋์ค
package extends1.ex2;
public class Child1 extends Parent {
public void play() {
System.out.println("๋์~~~~~~");
}
}
Main
package extends1.ex2;
public class ChildMain {
public static void main(String[] args) {
Child1 child1 = new Child1();
child1.play();
child1.income();
System.out.println("์ฐธ์ผ๋ก ์ข๊ฒ ๊ตฌ๋");
}
}
๋ถ๋ชจ์ ๊ฑด๋ฌผ์ ๋ฌผ๋ ค ๋ฐ์ ๋์๋ ์๋์๋์ผ๋ก ์ ๋จน๊ณ ์ ์ฌ๋ ๊ฑธ ํํ
'IT > development' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[thymeleaf] Thymeleaf Layout (feat. sb-admin 2) (33) | 2024.12.22 |
---|---|
[spring] AOP๋ก ํธ๋์ญ์ ๊ด๋ฆฌ (feat. ๋กค๋ฐฑ ์ฒ๋ฆฌ) (33) | 2024.12.01 |
[spring] spring security ์ด๊ฐ๋จ ์์ (3) | 2024.10.13 |
[java] Encapsulation(feat. simple example) (5) | 2024.09.29 |
[javascript] javascript this (42) | 2024.06.01 |
๋๊ธ