티스토리 뷰
Given the code fragment:
package ocjap;
public class Arr18 {
public static void main(String[] args) {
/* insert code here */
int array[2];
array[0]=10;
array[1]=20;
System.out.print(array[0]+":"+array[1]);
}
}
Which code fragment, when inserted at line 3, enables the code to print 10:20?
A. int[] array=new int[2];
B. int[] array;
array=int[2];
C. int array=new int[2];
D. int array[2];
정답: A
해설:
자바의 배열 선언방법
B번은 아래와 같은 오류가 발생.
The type of the expression must be an array type but it resolved to Class
C번 오류
Type mismatch: cannot convert from int[] to int
D번 오류
Syntax error on token "2", delete this token
'ocajp 자격증 (Oracle Certified Associate Ja' 카테고리의 다른 글
자바 ocjap 문제 해설 - do while (0) | 2020.02.24 |
---|---|
자바 ocjap 문제 해설 - Switch Case (0) | 2020.02.24 |
자바 ocjap 문제 및 해설 - 배열 (0) | 2020.02.23 |
자바 ocjap 문제 및 해설 - Exception (0) | 2020.02.23 |
자바 ocjap 문제 및 해설 - 배열 86 (0) | 2020.02.23 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- php
- esql
- 자바
- MySQL
- 스크래핑
- 자바 smtp
- 라이믹스 모듈
- C언어
- proc
- xe애드온
- C
- 파이썬
- EC
- 인포믹스
- XE
- 이클립스
- 포인터
- KG
- ocjap
- 문자열
- JDBC
- 파싱
- 플러터
- Python
- ocajp
- xe addon
- XE3
- 오라클
- webix
- 프로씨
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함