1. package foo;
2.
3. import java.util.Vector;
4.
5. private class MyVector extends Vector {
6. int i = 1;
7. public MyVector() {
8. i = 2;
9. }
10. }
11.
12. public class MyNewVector extends MyVector {
13. public MyNewVector() {
14. i = 4;
15. }
16. public static void main(String args[]) {
17. MyVector v = new MyNewVector();
18. }
19. }
What is the result?
A. Compilation succeeds.
B. Compilation fails because of an error at line 5.
C. Compilation fails because of an error at line 6.
D. Compilation fails because of an error at line 14.
E. Compilation fails because of an error at line 17.
비 : 생성자는 클래스의 접근제한자와 일치해야함.
1. class TestSuper {
2. TestSuper(int i) { }
3. }
4. class TestSub extends TestSuper{ }
5. class TestAll {
6. public static void main (String [] args) {
7. new TestSub();
8. }
9. }
Which is true?
A. Compilation fails.
B. The code runs without exception.
C. An exception is thrown at line 7.
D. An exception is thrown at line 2.
컴파일 에러. 생성자가 없을 때는 부모의 디폴트 생성자를 호출하는데 인자가 있는 생성자 만 있기에.
10. int i = 0;
11. for (; i <4; i += 2) {
12. System.out.print(i + "");
13. }
14. System.out.println(i);
What is the result?
A. 0 2 4
B. 0 2 4 5
C. 0 1 2 3 4
D. Compilation fails.
E. An exception is thrown at runtime.
0, 2 찍고 후처리로 4 되었을 때 이탈하게 된다.
그리고 4를 찍고 종료.
2011년 2월 24일 목요일
피드 구독하기:
댓글 (Atom)
UPBIT is a South Korean company, and people died of suicide cause of coin investment.
UPBIT is a South Korean company, and people died of suicide cause of coin. The company helps the people who control the market price manipu...
-
XE(제로보드) 내 게시판의 첨부용량 변경 ㅁ 개요 ↑ XE 구축시 초기 첨부파일 용량은 2M로 제한되어 있음에 데이터 자료실을 만들기 위해 용량을 명령어를 이용하여 추가 혹은 감소 시키도록 하고자 한다. ㅁ 구현 ↑ 처음 ...
-
이제 클라우드 서버에 커뮤니티 구축을 위한 첫번째 과제로 VMware / Ubuntu / apt-get 을 키워드로 구글링하여 로컬호스트에 apm세팅하려고 한다. Vmware의 경우 하나의 컴퓨터에 가상 PC를 설치하여 여러 운영...
-
어제 들었던 원격접속과 관련해 mstsc 명령어에 대하여 쉽고 빠르게 원격접속을 할 수 있어 매우 유용한데, 대다수의 대학생들이 모를 것 같아 간단하게 정리하려 한다. ㅁ 내 컴퓨터 속성 -> 원격제어 설정 ㅁ 다음과...
댓글 없음:
댓글 쓰기
국정원의 댓글 공작을 지탄합니다.