일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 전체텍스트
- 로또
- 이클립스
- 25가지 효율적인 sql작성법
- 스프링
- Validations
- Random
- 다형성
- 전자정부
- 가변인자
- 자바 야구게임
- 단축키
- while
- 상속
- jquery
- 전체
- Login with OAuth Authentication
- 상속예제
- full text indexing
- 다운캐스팅
- 야구게임
- angular2
- 추상클래스
- IBatis procedure
- 페이징
- 업캐스팅
- 자바
- 형변환
- Full text
Archives
- Today
- Total
nalaolla
내부클래스 본문
728x90
반응형
- package test.com;
- public class Test01Main {
- public static void main(String[] args) {
- System.out.println("Inheritance...");
- Test01AAA ta = new Test01AAA();
- ta = new Test01BBB();
- ta = new Test01CCC();
- ta.aaa();
- System.out.println("============================");
- Test01BBB tb = new Test01BBB();
- tb = new Test01CCC();
- System.out.println(tb.bbb());
- System.out.println("============================");
- Test01CCC tc = new Test01CCC();
- tc.aaa();
- tc.bbb();
- for (String x : tc.ccc()) {
- System.out.println(x);
- }
- System.out.println("============================");
- Test01DDD td = new Test01DDD() {
- //이름없는 내부 클래스 : anonymous inner class
- int x = 1000;
- @Override
- public void ddd() {
- // TODO Auto-generated method stub
- System.out.println("ddd()....111");
- }
- };
- td.ddd();
- // System.out.println("td.x : " + td.x); //접근불가
- td = new Test01EEE();
- td.ddd();
- System.out.println("============================");
- Test01EEE te = new Test01EEE();
- te.eee();
- System.out.println("te.ddd : " + te.ddd);
- }
- }
- package test.com;
- public class Test01AAA {
- int age = 33;
- String name = "daniel,kim";
- public void aaa() {
- System.out.println("age/name : " + age + "/" + name);
- }
- }
- package test.com;
- public class Test01BBB extends Test01AAA {
- int kor = 100;
- String subject = "국어";
- public String bbb() {
- System.out.println("bbb()...");
- aaa();
- return kor + subject;
- }
- }
- package test.com;
- public class Test01CCC extends Test01BBB {
- String title = "제목";
- String content = "내용";
- public String[] ccc() {
- return new String[]{title, content};
- }
- }
- package test.com;
- public abstract class Test01DDD {
- String ddd = "java";
- public abstract void ddd();
- }
728x90
반응형