File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 340
340
341
341
342
342
343
+ #### 2021년 3회 [ 2개 출제]
344
+
345
+ - 문제1. 다음 Java 코드에 대한 알맞는 출력값을 쓰시오.
346
+
347
+ ``` java
348
+ class Connection {
349
+ private static Connection _inst = null ;
350
+ private int count = 0 ;
351
+ static public Connection get () {
352
+ if (_inst == null ) {
353
+ _inst = new Connection ();
354
+ return _inst;
355
+ }
356
+ return _inst;
357
+ }
358
+ public void count () { count ++ ; }
359
+ public int getCount () { return count; }
360
+ }
361
+
362
+ public class testcon {
363
+ public static void main (String [] args ) {
364
+ Connection conn1 = Connection . get();
365
+ conn1. count();
366
+ Connection conn2 = Connection . get();
367
+ conn2. count();
368
+ Connection conn3 = Connection . get();
369
+ conn3. count();
370
+
371
+ System . out. print(conn1. getCount());
372
+ }
373
+ }
374
+ ```
375
+
376
+ - [ 답] 3
377
+
378
+
379
+
343
380
#### 2022년 3회
344
381
345
382
- 문제4. 다음 JAVA로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오. (단, 출력문의 출력 서식을 준수하시오.)
You can’t perform that action at this time.
0 commit comments