목차는 저작권에 안걸리겠죠!?
일단 이 기준으로 해서 진행해야겠습니다.
제1부 컴퓨터공학의 이해
1장 컴퓨터 개요
2장 정보통신 기초
3장 컴퓨터의 현재와 미래
제2부 컴퓨터공학 하드웨어 관련 기술
4장 컴퓨터 구조
5장 컴퓨터 네트워크
6장 멀티미디어 정보통신
3부 컴퓨터공학 소프트웨어 관련기술
7장 프로그래밍 언어
8장 컴퓨터 운영체제
9장 데이터베이스
10장 인공지능
제4부 인터넷 응용기술
11장 인터넷 기초
12장 인터넷 활용
13장 인터넷 고급기술
14장 인터넷 보안과 미래
Question 21 : 추상클래스
Given:
11. public abstract class Shape {
12. int x;
13. int y;
14. public abstract void draw();
15. public void setAnchor(int x, int y) {
16. this.x = x;
17. this.y = y;
18. }
19. }
and a class Circle that extends and fully implements the Shape class.
Which is correct?
A. Shape s = new Shape();
s.setAnchor(10,10);
s.draw();
B. Circle c = new Shape();
c.setAnchor(10,10);
c.draw();
C. Shape s = new Circle();
s.setAnchor(10,10);
s.draw();
D. Shape s = new Circle();
s->setAnchor(10,10);
s->draw();
E. Circle c = new Circle();
c.Shape.setAnchor(10,10);
c.Shape.draw();
[HeadFirst Java - p.234]
어떤 클래스의 인스턴스를 만들 수 없게 하는 간단한 방법이 있습니다. 즉 특정 유형에 대해 "new" 키워드를 쓸 수 없게 하는 방법입니다. 클래스를 abstract로 지정하면 컴파일러에서 그 유형의 인스턴스를 만드는 코드를 허용하지 않습니다. 하지만 그 추상 유형(abstract type)을 레퍼런스로 사용할 수 있습니다. 사실 그렇게 레퍼런스로 사용하는 것이 바로 이런 추상 클래스를 만드는 핵심적인 이유 중의 하나라고 볼 수 있습니다.
Answer: C
Question 20 : 내부 무명 클래스
Given:
1. interface TestA { String toString(); }
2. public class Test {
3. public static void main(String[] args) {
4. System.out.println(new TestA() {
5. public String toString() { return “test”; }
6. });
7. }
8. }
What is the result?
A. test
B. null
C. An exception is thrown at runtime.
D. Compilation fails because of an error in line 1.
E. Compilation fails because of an error in line 4.
F. Compilation fails because of an error in line 5.
Answer : A