<br><span class="class" style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span class="keyword" style="font-weight:bold;">class</span> <span class="title" style="color:#880000;font-weight:bold;">Updator</span> </span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">{</span> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">public</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">void</span><span style="font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span style="background-color:#eeece1;"> update(</span><span style="background-color:#fac08f;"><b>Counter</b> counter</span><span style="background-color:#eeece1;">) {</span></span> <div><span style="font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span style="background-color:#eeece1;"> counter.count++;</span></span></div> <div><span style="font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span style="background-color:#eeece1;"> </span></span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">} </span></div> <div><span style="font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span style="background-color:#eeece1;">} </span></span></div> <div><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><br></span></div> <div><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">public</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="class" style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span class="keyword" style="font-weight:bold;">class</span> <span class="title" style="color:#880000;font-weight:bold;">Counter</span> </span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">{</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">int</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> count = </span><span class="number" style="background-color:#eeece1;color:#008800;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">0</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">;</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">public</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">static</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">void</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> main(String[] args) {</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> Counter myCounter = </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">new</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> Counter();</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> System.out.println(</span><span class="string" style="background-color:#eeece1;color:#880000;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">"before update:"</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">+myCounter.count);</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> Updator myUpdator = </span><span class="keyword" style="background-color:#eeece1;font-weight:bold;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">new</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> Updator();</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> myUpdator.update(myCounter); </span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"><span class="Apple-tab-span" style="white-space:pre;"> </span> System.out.println(</span><span class="string" style="background-color:#eeece1;color:#880000;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">"after update:"</span><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;">+myCounter.count);</span></div> <div><span style="background-color:#eeece1;font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;"> }</span></div> <div><span style="font-family:Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', '맑은고딕', 'Malgun Gothic';font-size:13px;white-space:pre-wrap;background-color:#f0f0f0;">}</span><br><font face="Arial"><br><span style="background-color:#ffffff;">에서 <span style="font-size:13px;white-space:pre-wrap;"><b>Counter</b> counter과 같이 클래스로 변수의 타입을 선언한 부분이 이해가 가지 않습니다. </span></span>구체적으로 어떤 부분이 이해가 가지 않느냐하면, <b>Counter 클래스</b>로 변수의 타입을 선언할 수 있다는 것은 이해가 가는데<br><span style="font-size:13px;white-space:pre-wrap;"><b>Counter </b>counter로 변수타입을 선언하면 도대체 <font color="#ff0000">어떤 결과</font>를 가져올 수 있는거죠? </span><b>int </b>counter와 같이 기본타입으로 선언된 경우는 counter 변수가 숫자를 갖을 수 있다 라는 명확한 의미가 있기에 이해가 가는데<br><span style="font-size:13px;white-space:pre-wrap;"><b>Counter</b> counter와 같은 경우는 변수 counter을 <b>Counter</b>타입으로 선언했다고 한들 무슨 의미가 있는 것이죠? </span>counter가 <b>Counter</b> 클래스의 인스턴트 변수나 메소드를 사용할 수 있는 것 외에 다른 어떤 의미를 갖을 수 있는지.. 이해가 </font>안가네요.<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.