class C2 { public void displayC2() { System.out.print("C2"); } } interface I { public void displayI(); } class C1 extends C2 implements I { public void displayI() { System.out.print("C1"); } } public class Extend76 { public static void main(String[] args) { C2 obj1=new C1(); I obj2=new C1(); C2 s = obj2; I t=obj1; t.displayI(); s.displayC2(); } } What is the result? A. C2C2 B. C1C2 C. C1C1 D. Co..
public class Switch78 { public static void main(String[] args) { int wd=0; String days[]= {"sun","mon","wed","sat"}; for(String s:days) { switch(s) { case "sat": case "sun": wd-=1; break; case "mon": wd++; case "wed": wd+=2; } } System.out.println(wd); } } What is the result? A. 3 B. 4 C. -1 D. Compilation fails. 정답: A 결과: 3 해설: 아래처럼 찍어보면 이해가 쉽다. switch case를 쓸때 주의할 점이 break가 없는 case에서는 아래 case가..
아 switch case는 if else 처럼 잘 쓰지 않아서 가끔 볼때마다 헷갈린다.. break가 없을 경우 case 아래를 무조건 실행하는게 좀 이해가 안간다... 암튼.. switch문은 어떤 변수의 값에 따라서 문장을 실행할 수 있도록 하는 제어문이다. switch문에서 사용하는 키워드는 switch, case, default, break 이다. switch문 switch(변수){ case 값1 : 실행문; break; case 값2 : 실행문; break; default; } int value = 1; switch(value){ case 1: System.out.println("1"); break; case 2: System.out.println("2"); break; case 3 : Syst..
public class Array84 { public static void main(String[] args) { int array[]= {10,20,30,40,50}; int x=array.length; /* line n1 */ } } A. while(x>0) { x--; System.out.print(array[x]); } B. do { x--; System.out.print(array[x]); }while(x>=0); C. while(x>=0) { System.out.print(array[x]); x--; } D. do { System.out.print(array[x]); --x; }while(x>=0); E. while(x>0) { System.out.print(array[--x]); } Whic..
class Student{ String name; public Student(String name) { this.name=name; } } public class Array86 { public static void main(String[] args) { Student[] students = new Student[3]; students[1]=new Student("Richard"); students[2]=new Student("Donald"); for (Student s : students) { System.out.println(""+s.name); } } } What is the result? A. null Richard Donald B. Richard Donald C. Compilation fails...
- Total
- Today
- Yesterday
- KG
- 파이썬
- 파싱
- 인포믹스
- 포인터
- webix
- 이클립스
- EC
- ocajp
- php
- xe애드온
- 오라클
- C
- 플러터
- XE
- JDBC
- MySQL
- XE3
- proc
- xe addon
- Python
- 문자열
- 스크래핑
- 라이믹스
- ocjap
- C언어
- 자바 smtp
- 자바
- esql
- 프로씨
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
