<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>달콤 쌉싸래한 인생 &#187; bitacademy</title>
	<atom:link href="http://jongsunkim.pe.kr/archives/category/programming/java/bitacademy/feed" rel="self" type="application/rss+xml" />
	<link>http://jongsunkim.pe.kr</link>
	<description>Be fully awake if you want to dream</description>
	<lastBuildDate>Sat, 19 Nov 2011 08:34:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Java-13강</title>
		<link>http://jongsunkim.pe.kr/archives/396</link>
		<comments>http://jongsunkim.pe.kr/archives/396#comments</comments>
		<pubDate>Tue, 12 Jan 2010 02:00:20 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=396</guid>
		<description><![CDATA[2010년 1월 11일 월요일 13강 Object Class finalize() &#8211; 소멸자 Wrapper class primitive data type을 object로. 8개가 존재. stack에 올라온 것을 heap으로 Math Class round() 반올림 floor() 무조건 자름 ceil() 무조건 올림 String Class Strings are constant. getByte() length() &#8211; 문자갯수(o), 문자길이(x) substring() &#8211; 문자열을 뽑아낼 때, javascript와 동일 StringBuffer class Is final class string 수정가능. [...]]]></description>
			<content:encoded><![CDATA[<h1>2010년 1월 11일 월요일 13강</h1>
<h2>Object Class</h2>
<div>finalize() &#8211; 소멸자</div>
<h2>Wrapper class</h2>
<div>primitive data type을 object로. 8개가 존재.</div>
<div>stack에 올라온 것을 heap으로</div>
<h2>Math Class</h2>
<div>round() 반올림</div>
<div>floor() 무조건 자름</div>
<div>ceil() 무조건 올림</div>
<h2>String Class</h2>
<div>
<ul>
<li>Strings are <em><span style="text-decoration: underline;">constant</span></em>.</li>
</ul>
</div>
<div>getByte()</div>
<div>length() &#8211; 문자갯수(o), 문자길이(x)</div>
<div>substring() &#8211; 문자열을 뽑아낼 때, javascript와 동일</div>
<h2>StringBuffer class</h2>
<div>Is final class</div>
<div>string 수정가능.</div>
<div>속도때문에 string 대신 stringbuffer를 사용.</div>
<div>string은 주소를 새로 할당해야하므로 느림.</div>
<div>StringBuilder (x) = v1.5이후 나옴</div>
<div>StringBuffer (o)</div>
<div>차이는 thread의 synchronization을 하느냐의 차이</div>
<div>동기화</div>
<h2>System class</h2>
<div>플랫폼과 밀접한관계를 맺고있다.</div>
<div>os의 정보를 읽어온다.</div>
<h2>Java.util Package</h2>
<div>1. Utility class (ch13)<br />
2. Collection Framework (자바의 자료구조) (ch15)</div>
<div>Generic (ch14)</div>
<h3>Utility</h3>
<div>Enumeration&lt;E&gt; interface</div>
<div>Stack&lt;E&gt; class</div>
<div>Queue interface &#8211; LinkedList를 써야함</div>
<h2>StringTokenizer class</h2>
<div>/*</div>
<div>
<div>* String parsing 방법 3가지</div>
<div>*</div>
<div>* 1. String 클래스의 split()</div>
<div>* 2. java.util.StringTokenizer 객체이용하기</div>
<div>* 3. java.util.Scanner 객체이용하기</div>
<div>*</div>
<div>*/</div>
</div>
<div>부모는 Enumeration&lt;E&gt;</div>
<h2>Random class</h2>
<div>is used to generate a stream fo pseudorandom numbers</div>
<h2>Date class</h2>
<div>represents a specific instant in time, with millisecond precision.</div>
<h2>Calendar class</h2>
<div>시작일이 무슨 요일인가와</div>
<div>이 달의 마지막 날짜</div>
<div>gregorianCalendar 년월일 세팅할때</div>
<div>getActualMaxium</div>
<h2>Locale class</h2>
<div>a locale object represents a specific geographical, political, or cultural</div>
<h2>Formatter class</h2>
<div>an interpreter for printf-style</div>
<div>java.util.formatter</div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/396/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-12강</title>
		<link>http://jongsunkim.pe.kr/archives/383</link>
		<comments>http://jongsunkim.pe.kr/archives/383#comments</comments>
		<pubDate>Fri, 08 Jan 2010 12:06:14 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=383</guid>
		<description><![CDATA[2010년 1월 8일 12강 Event Model What is an Event? Events &#8211; Objects that describe what happened. Events Source &#8211; The generator of an event Events handlers &#8211; A method that receives an event object, deciphers it, and processes the user&#8217;s interaction Events Listener 이벤트 객체 &#8211; 클래스 이벤트 리스너 &#8211; 인터페이스 이벤트 핸들러 &#8211; [...]]]></description>
			<content:encoded><![CDATA[<h2>2010년 1월 8일 12강</h2>
<div><strong><span style="font-size: medium;">Event Model</span></strong></div>
<div>What is an Event?</div>
<div>
<ul>
<li>Events &#8211; Objects that describe what happened.</li>
<li>Events Source &#8211; The generator of an event</li>
<li>Events handlers &#8211; A method that receives an event object, deciphers it, and processes the user&#8217;s interaction</li>
<li>Events Listener</li>
</ul>
</div>
<p>이벤트 객체 &#8211; 클래스</p>
<div>이벤트 리스너 &#8211; 인터페이스</div>
<div>이벤트 핸들러 &#8211; 메소드</div>
<h2>Even Adapter</h2>
<p>class</p>
<h2>Exceptions and Assertions</h2>
<div>assertions은 개발자용, 안씀, 툴이 없는 환경에서 디버깅을 위해 사용, 이클립스에 디버깅 기능을 사용하므로 필요없다.</div>
<div>exception은 사용자용, 예외처리,</div>
<div>The Exception class defines mild error conditions that your program encounters.</div>
<div>The Error class defines  serious error conditions.</div>
<h4>checked exception</h4>
<div>General Exception</div>
<div>try-catch 반드시 써야함</div>
<h4>unchecked exception</h4>
<div>RuntimeException, error</div>
<div>try-catch 써도되고 안써도되고</div>
<h4>Throwable class</h4>
<div>JSP에서 exception 객체는 Throwable class.</div>
<div>
<ul>
<li>catch하는 방법</li>
<li>exception 던지는 방법</li>
<li>exception 선언하는 방법</li>
</ul>
</div>
<h2>Throwing Exceptions</h2>
<div>
<ul>
<li>Throw an appropriate exception</li>
<li>give the exception a meaningful message</li>
</ul>
</div>
<div>exception을 개발자가 의도적으로 발생시킬 때</div>
<div>&#8220;throw new 예외&#8221;</div>
<h2>throws</h2>
<div>메소드 안에서 예외 사용을 알림</div>
<div>
<div>
<table id="c9xy" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="100%">access modifier 일반 modifier 리턴타입 이름() throws 예외이름{}</td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Printing information about exceptions</h2>
<div>- The printStackTrace() method</div>
<div>returns a detailed message string about the exception</div>
<div>- The toString() method</div>
<div>returns a detailed message string about the exception</div>
<h2>The finally Statement</h2>
<div>try-catch-finally</div>
<div>try-finally</div>
<div>
<ul>
<li>The finally statement defines a block of code that always executes, regardless of whether an exception was caught.</li>
<li>the catch block may be omitted when the finally clause is used.</li>
</ul>
</div>
<h2>Creating your own Exception</h2>
<div>
<ol>
<li>내가 만든 exception의 부모가 checked exception or unchecked exception 될지 고려.</li>
<li>메시지 처리를 어떻게 할건지..</li>
</ol>
</div>
<h2>Assertions</h2>
<div>툴없이 디버깅을..</div>
<div>
<div>
<table id="o:s-" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="100%">
<div>assert logical_expression;</div>
<div>assert logical_expression : message;</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>조건에 안맞으면 assertion 에러가 발생</div>
<div>command option</div>
<div>&gt;java <strong>-ea</strong> 클래스명</div>
<div>하면 assertion 검사.</div>
<div>
<hr /></div>
<div>
<h3>Java Graphics</h3>
</div>
<div><strong>JFC (Java Foundation Class)</strong></div>
<div>
<ol>
<li>AWL</li>
<li>Swing</li>
<li>Drag&amp;Drop</li>
<li>Accessibility</li>
<li>Java 2D</li>
</ol>
</div>
<div>자바 그래픽은 생산성이 떨어짐.</div>
<div>요즘은</div>
<div>flex(client) + Java(server)</div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/383/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-11강</title>
		<link>http://jongsunkim.pe.kr/archives/379</link>
		<comments>http://jongsunkim.pe.kr/archives/379#comments</comments>
		<pubDate>Thu, 07 Jan 2010 11:53:41 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=379</guid>
		<description><![CDATA[2010년 1월 7일 11강 Class(static) Variable Are shared among all instances of a class static &#8211; 공유변수 Class(static) Methods 주소없이 접근하기 위해 new 없이 접근하기 위해 static을 쓴다. static Initializers 스태틱 초기화 블럭 static block code executes only once, when the class is loaded static block is usually used to initialize static attributes ex) private final [...]]]></description>
			<content:encoded><![CDATA[<h1>2010년 1월 7일 11강</h1>
<div>
<hr /></div>
<h2>Class(static) Variable</h2>
<div>Are shared among all instances of a class</div>
<div>static &#8211; 공유변수</div>
<h2>Class(static) Methods</h2>
<div>주소없이 접근하기 위해</div>
<div>new 없이 접근하기 위해 static을 쓴다.</div>
<div>
<h2><span style="font-size: medium;">static Initializers <span style="font-size: x-small;">스태틱 초기화 블럭</span></span></h2>
</div>
<div>
<ul>
<li><span style="font-size: x-small;">static block code executes only once, when the class is loaded</span></li>
<li><span style="font-size: x-small;">static block is usually used to initialize static attributes</span></li>
</ul>
</div>
<div>
<div>
<table id="c.yt" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="100%">
<div>ex)</div>
<div>private final int YEAR; &#8211; final이 붙은 멤버변수는 초기화는 생성자에서..</div>
<div>private static final int DAY; &#8211; static final 의 초기화는 static 초기화 블록에서 초기화..</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>변수의 초기화는 생성자나 초기화블록을 통해서..</div>
<div>클래스에 static을 사용하려면 내부클래스여야만 사용가능</div>
<h2>The <span style="color: #0000ff;">final</span> Keywords</h2>
<div>class 앞에 쓸 수 있는 (access) modifier : public, [default], abstract, final class Demo</div>
<p>variable 앞에 : public, private, protected, [default] int su;</p>
<div>
<div>method 앞에 : public, private, protected, [default], final, static, abstract, int method()</div>
</div>
<div>멤버, 스태틱, 지역 상수</div>
<h2>Deprecation</h2>
<div>//&#8230;</div>
<h2>Inner Class</h2>
<div>allow a class definition to be placed inside another class definition.</div>
<div>
<ul>
<li>Nested Class</li>
<li>Member Class</li>
<li>Local Class</li>
<li>Anonymous Class</li>
</ul>
</div>
<div>1.why?<br />
2.생성방법<br />
3.제한사항</div>
<h3>Nested Class</h3>
<div>
<div>/*</div>
<div>* static class(Nested Class)</div>
<div>* 1. why: class를 packaging 하기 위해</div>
<div>* 2. 생성방법: Outer.Inner in = new Outer.Inner();</div>
<div>* 즉 바깥클래스의 주소 필요하지 않다.</div>
<div>* 3. 제한사항: outer class의 멤버변수, 멤버메소드 접근 불가</div>
<div>*</div>
<div>*/</div>
</div>
<div>packaging..하기위한..</div>
<div>class com{</div>
<div>static class javasoft{</div>
<div>static class lib{</div>
<div>static class Test{}</div>
<div>}</div>
<div>}</div>
<div>static class jspsoft{</div>
<div>static class lib{}</div>
<div>}</div>
<div>}</div>
<div>com.javasoft.lib.Test t = new com.javasoft.lib.Test();</div>
<div><strong><span style="font-size: small;">Member class</span></strong></div>
<div>
<div>/*</div>
<div>* member class</div>
<div>* 1. why?: 다중상속가능</div>
<div>* 2. 생성방법: 바깥쪽 클래스의 주소가 필요하다.</div>
<div>* Outer.Inner in = out.new Inner();</div>
<div>* 3. 제한사항: static 변수나 static method를 가질 수 없다.</div>
<div>*/</div>
</div>
<div>static variable, method 를 가질 수 없다.</div>
<div>다중상속 가능.</div>
<h3>Local Class</h3>
<div>
<div>/*</div>
<div>* Local class</div>
<div>* 1. why?: scope를 가장 짧게하기 위해서, 메소드가 실행되는 동안만 가능</div>
<div>* 2. 생성방법: 자기가 속한 메소드를 호출해야만 생성가능</div>
<div>* 3. 제한사항: 1) 자기가 속한 메소드의 순서를 지켜야한다.</div>
<div>* 2) access modifier 사용할 수 없다.</div>
<div>* 3) static 사용할 수 없다</div>
<div>* 4) 바깥 클래스의 멤버변수, 스태틱변수 접근가능</div>
<div>* 자기가 속한 메소드, 지역변수 접근 불가능</div>
<div>* 자기가 속한 지역 상수만 접근가능</div>
<div>*</div>
<div>*/</div>
</div>
<h3>Anonymous Class</h3>
<div>local class의 제한사항과 똑같음</div>
<h2>enum type</h2>
<div>(실제 필드에서는 잘 안쓴다..)</div>
<div>class Weekend{</div>
<div>public static final int SUN = 0;</div>
<div>public static final int MON = 1;</div>
<div>}</div>
<div>interface Weekend{</div>
<div>int SUN = 0;</div>
<div>int MON = 1;</div>
<div>}</div>
<div>enum Weekend{</div>
<div>SUN, MON;</div>
<div>}</div>
<div>enum에는 data type을 입력하지 않음</div>
<div>
<div>// 상수들만 되어있기 때문에 new를 쓸 필요없다.</div>
<div>// 클래스가 아니므로</div>
<div>//Weekend w = new Weekend();</div>
<div>Java API</div>
<p>java.lang.Enum&lt;E&gt;</p>
</div>
<div>switch문에 사용한다.</div>
<div>values()를 이용해서 for each를 이용 배열로 뽑아낼 수 있다.</div>
<div>SCJP에서는 enum 알아야함</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/379/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-10강</title>
		<link>http://jongsunkim.pe.kr/archives/375</link>
		<comments>http://jongsunkim.pe.kr/archives/375#comments</comments>
		<pubDate>Wed, 06 Jan 2010 11:59:56 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=375</guid>
		<description><![CDATA[2010년 1월 6일 10강 Abstract Methods 오버라이드의 강제화 객체생성 불가능 자식객체를 이용해야함. Interface 다중상속을 목적으로 인터페이스는 클래스가 아니다. 인스턴스화 할 수 없다. 변수를 가질 수 없다. 메소드 가질 수 없다. 상수 &#38; 추상메소드 만 가능하다. Java는 다중상속을 위해서 Interface라는 개념을 사용 객체 복제. clone() 객체의 값복사, cloneable 인터페이스가 필요 try catch 써야함, 예외잡기. 정상적인 객체는 [...]]]></description>
			<content:encoded><![CDATA[<h1>2010년 1월 6일 10강</h1>
<h2>Abstract Methods</h2>
<div>오버라이드의 강제화</div>
<div>객체생성 불가능</div>
<div>자식객체를 이용해야함.</div>
<h2>Interface</h2>
<div>
<ul>
<li>다중상속을 목적으로</li>
<li>인터페이스는 클래스가 아니다.</li>
<li>인스턴스화 할 수 없다.</li>
<li>변수를 가질 수 없다.</li>
<li>메소드 가질 수 없다.</li>
<li>상수 &amp; 추상메소드 만 가능하다.</li>
</ul>
</div>
<div>Java는 다중상속을 위해서 Interface라는 개념을 사용</div>
<div>객체 복제.</div>
<h2>clone()</h2>
<div>객체의 값복사, cloneable 인터페이스가 필요</div>
<div>try catch 써야함, 예외잡기.</div>
<div>정상적인 객체는 복제 안됨</div>
<div>cloneable 자식들만 복제가능함</div>
<h3>java.lang</h3>
<div><strong>method</strong></div>
<div>clone()</div>
<div><strong>interface</strong></div>
<div>cloneable</div>
<div>재정의할 메소드 없음.</div>
<div>cloneable interface가 붙은 자식들만이 값복제 가능</div>
<div><strong>mark(flag) interface</strong></div>
<div>재정의할 메소드 없음, 상수 없음</div>
<div>기능없음.</div>
<div>shallow copy(값 복사) &lt;-&gt; deep copy(주소복사)</div>
<h2>CLASSPATH 를 잡는 이유</h2>
<div>컴파일할 때 컴퍼넌트가 어디에 있는지를 잡아줘야한다</div>
<div>파일의 위치가 만약</div>
<div>C:\temp</div>
<div>Component.java</div>
<div>Component.class</div>
<div>D:\jongsun</div>
<div>Main.java</div>
<div>Main.class</div>
<div>있다면</div>
<div>- complie option</div>
<div>&gt;javac -classpath C:\temp Component.java</div>
<div>- runtiime option</div>
<div>&gt;java -classpath .;C:\temp Main</div>
<div>운영체제 환경변수에 &#8220;CLASSPATH&#8221;를 세팅하면 컴파일, 실행시 옵션 지정 안해도 됨.</div>
<div>경로가 바뀔 경우에는 옵션지정.</div>
<h2>Package와 import</h2>
<div><strong>- package </strong></div>
<div>유사한 클래스들의 묶음</div>
<div>디렉토리</div>
<div>해당 디렉토리에 package&#8230;</div>
<div>package com.javasoft.lib.HR; 라는 package를 선언했다면</div>
<div>complie option</div>
<div>javac -d C:\temp Insa.java</div>
<div>c:\temp 아래 com-&gt;javasoft-&gt;lib-&gt;HR</div>
<div><strong>- import</strong></div>
<div>FQN(Fully Qualified Name) 방식</div>
<div>Java home path로 부터</div>
<div><strong>- jar 만들기</strong></div>
<div>C:\temp&gt; jar -cvf example.jar /com</div>
<div>example.jar 복사</div>
<div>C:\Program Files\Java\jre6\lib\ext</div>
<div>classpath 관련 글들..</div>
<div><a href="http://www.javaexpert.co.kr/entry/17">http://www.javaexpert.co.kr/entry/17</a></div>
<div><strong>- static import</strong></div>
<div>syntax:</div>
<div>import static TypeName.*;</div>
<h2>Advanced Access Control</h2>
<div>
<div>
<table id="jilp" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="20%">modifier</td>
<td width="20%">same class</td>
<td width="20%">same package</td>
<td width="20%">subclass</td>
<td width="20%">universe</td>
</tr>
<tr>
<td width="20%">public</td>
<td width="20%">y</td>
<td width="20%">y</td>
<td width="20%">y</td>
<td width="20%">y</td>
</tr>
<tr>
<td width="20%">protected</td>
<td width="20%">y</td>
<td width="20%">y</td>
<td width="20%">y</td>
<td width="20%"></td>
</tr>
<tr>
<td width="20%">default</td>
<td width="20%">y</td>
<td width="20%">y</td>
<td width="20%"></td>
<td width="20%"></td>
</tr>
<tr>
<td width="20%">private</td>
<td width="20%">y</td>
<td width="20%"></td>
<td width="20%"></td>
<td width="20%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div>public &#8211; 클래스, 변수, 메소드</div>
<div>protected &#8211; 변수, 메소드</div>
<div>default &#8211; 클래스, 메소드, 변수</div>
<div>private &#8211; 변수, 메소드</div>
<div>내일은..</div>
<div>static</div>
<div>inner class</div>
<div>
<hr /></div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/375/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-9강</title>
		<link>http://jongsunkim.pe.kr/archives/356</link>
		<comments>http://jongsunkim.pe.kr/archives/356#comments</comments>
		<pubDate>Tue, 05 Jan 2010 14:36:12 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=356</guid>
		<description><![CDATA[2009년 1월 5일 9강 9장 Polymorphism 객체지향의 완성은 &#8220;다형성&#8221; Is a powerful feature of OO Means &#8220;many forms&#8221; Is the ability to have many different forms Can be used in two ways: polymorphic parameters heterogeneous collections instanceof 부모, 자식 형변환 가능한지 여부를 확인 true, false 를 리턴. 오리지날 타입을 알기 위해 사용. - 다형성의 문제 [...]]]></description>
			<content:encoded><![CDATA[<h1>2009년 1월 5일 9강</h1>
<h2>9장 Polymorphism</h2>
<p>객체지향의 완성은 &#8220;다형성&#8221;</p>
<div>
<ul>
<li>Is a powerful feature of OO</li>
<li>Means &#8220;many forms&#8221;</li>
<li>Is the ability to have many different forms</li>
</ul>
<div>Can be used in two ways:</div>
<div>
<ul>
<li>polymorphic parameters</li>
<li>heterogeneous collections</li>
</ul>
</div>
</div>
<div><strong>instanceof</strong></div>
<div>부모, 자식 형변환 가능한지 여부를 확인 true, false 를 리턴.</div>
<div>오리지날 타입을 알기 위해 사용.</div>
<div>- 다형성의 문제</div>
<div>자식은 부모형으로 형변환 될 수 있다라는 점이 문제.</div>
<div>그래서 나온 것이 Generic (15장에서 배움)</div>
<h2>Overriding Methods</h2>
<div>Virtual method invocation:</div>
<div>Employee e = new Manager();</div>
<div>e.getDetails();</div>
<div>Complie-time type and runtime type</div>
<div>선언형이나 실제형이냐..</div>
<div><strong>- Rules about Overriden Methods</strong></div>
<div>cannot be less accessible than the method it overrides.</div>
<div></div>
<hr />
<h2>10장</h2>
<h2>Abstract Method</h2>
<div>자식클래스에서 무조건 재정의 해야함.</div>
<div>오버라이드의 강제화를 위해..</div>
<h2>Abstract Class</h2>
<div>추상 메서드를 갖고 있다면 무조건 추상 클래스로 된다.</div>
<div>정상적인 클래스도 abstract를 쓸 수 있다. 이유는 new를 통한 인스턴스생성을 못하게 하려고..</div>
<div>
<ul>
<li>member variable</li>
<li>static variable</li>
<li>member method</li>
<li>static method</li>
<li>abstract method</li>
</ul>
</div>
<div>위에 5가지로 추상 클래스를 만들 수 있다.</div>
<div>
<hr /></div>
<div><strong><span style="font-size: medium;">Interface</span></strong></div>
<div>
<ul>
<li>an interface is variation on the idea of an abstract class.</li>
<li>In an interface, all the methods are <span style="text-decoration: underline;">abstract</span>.</li>
<li>In an interface, all variables are <span style="text-decoration: underline;">constant</span>.</li>
</ul>
</div>
<div>추상클래스 계열</div>
<div>클래스는 아님.</div>
<div>부모가 여러 개여도 됨(다중상속)</div>
<div>
<ul>
<li>abstract method</li>
<li>constant</li>
</ul>
</div>
<div>인터페이스는 위의 2개로 구성</div>
<div>인터페이스 속에는 모두 static, final이므로 생략가능한다.</div>
<div>
<div>
<table id="jzw." border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="50%">자식</td>
<td width="50%">부모</td>
</tr>
<tr>
<td width="50%">class <strong>extends</strong></td>
<td width="50%">class</td>
</tr>
<tr>
<td width="50%">interface <strong>extends </strong></td>
<td width="50%">interface</td>
</tr>
<tr>
<td width="50%">class <strong>implements </strong></td>
<td width="50%">interface</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><strong>interface</strong></div>
<div>
<ul>
<li>다중상속</li>
<li>Mark(flag) interface &#8211; 멤버가 하나도 없는 인터페이스, UML은 동그라미표시</li>
</ul>
</div>
<div>내일은</div>
<div>mark interface</div>
<div>객체의 주소, 값 복제</div>
<div>내부클래스</div>
<div>빨리끝나면 GUI</div>
<div>그래픽 인터페이스 이벤트 모델</div>
<div>
<hr /></div>
<div>Java + .NET -&gt; actionScript</div>
<div>JDBC -&gt; .NET의 ADO.NET</div>
<div>JSP -&gt; ASP.NET</div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/356/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-8강</title>
		<link>http://jongsunkim.pe.kr/archives/345</link>
		<comments>http://jongsunkim.pe.kr/archives/345#comments</comments>
		<pubDate>Mon, 04 Jan 2010 11:42:54 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=345</guid>
		<description><![CDATA[2010년 1월 4일 Java 8강 8장 What is a Inheritance? Inheritance specifies an &#8220;is a kind of&#8221; relationship Inheritance is a class relationship New classes specialize existing classes 자식이 부모가 갖고있는 기능을 확장. 기존에 존재하는 클래스를 구체화. Single and Multiple Inheritance Single inheritance: extending from one super class (Java, .NET) Multiple inheritance: extending from two [...]]]></description>
			<content:encoded><![CDATA[<h1>2010년 1월 4일 Java 8강</h1>
<h3><strong><span style="font-size: medium;">8장</span></strong></h3>
<h2>What is a Inheritance?</h2>
<p>Inheritance specifies an &#8220;is a kind of&#8221; relationship</p>
<div>
<ul>
<li>Inheritance is a class relationship</li>
<li>New classes specialize existing classes</li>
</ul>
</div>
<div>자식이 부모가 갖고있는 기능을 확장.</div>
<div>기존에 존재하는 클래스를 구체화.</div>
<h2>Single and Multiple Inheritance</h2>
<div>
<ul>
<li>Single inheritance: extending from one super class (Java, .NET)</li>
<li>Multiple inheritance: extending from two or more super class (C++..)</li>
</ul>
</div>
<p>상속은 복사의 개념이 아닌 공유의 개념.</p>
<div>
<ol>
<li>부모-자식</li>
<li>전체-부품</li>
<li>has-a (대등관계)</li>
</ol>
</div>
<div>
<div>
<table id="b0wu" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="33.333333333333336%"></td>
<td width="33.333333333333336%">자식</td>
<td width="33.333333333333336%">부모</td>
</tr>
<tr>
<td width="33.333333333333336%">C++</td>
<td width="33.333333333333336%">Derived <span style="color: #ff0000;">:</span></td>
<td width="33.333333333333336%">(상속유형(지정자))Base Class</td>
</tr>
<tr>
<td width="33.333333333333336%">Java</td>
<td width="33.333333333333336%">Subclass <span style="color: #ff0000;">extends</span></td>
<td width="33.333333333333336%">Super Class</td>
</tr>
<tr>
<td width="33.333333333333336%">C#</td>
<td width="33.333333333333336%">Derived <span style="color: #ff0000;">:</span></td>
<td width="33.333333333333336%">Base Class</td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Inheritance</h2>
<div>Inheritance is the OO term referring to grouping classes together based on common theme or common attributes.</div>
<div>Use the keyword <span style="color: #0000ff;">extends</span></div>
<div>다중상속은 interface를 사용한다.</div>
<div>1.생성자는 상속되지 않는다.</div>
<div>부모의 생성자를 호출하려면 super 메소드를 사용</div>
<div>2.private은 상속되지 않는다.</div>
<div>3.static은 상속과 관련이 없다.</div>
<div>4.overshadow 변수는 상속되지 않는다.</div>
<div>5.오버라이드 메소드는 상속되지 않는다.</div>
<div>Java는 대부분의 메소드의 재정의를 허용한다.</div>
<div>
<h2><span style="font-size: medium;"><span style="text-decoration: underline;">상속이 안되는 4가지</span></span></h2>
<div>
<ol>
<li>private</li>
<li>static</li>
<li>constructor =&gt; super()</li>
<li>overshadow / override method =&gt; super.</li>
</ol>
<h2>The &#8220;is a&#8221; Relationship &#8211; 상속관계</h2>
<div>A class can inherit from only one superclass at a time.</div>
<div>&#8220;is a&#8221; 가 말이되면 상속관계.</div>
<div>is a 대신 extends</div>
<h2>The &#8220;has a&#8221; Relationship &#8211; 포함관계</h2>
<div>Containment</div>
<div>Write a class that contain a reference to other classes.</div>
<div>
<hr /></div>
<div>this()와 super()는 같이 쓸 수 없다.</div>
<div>둘 다 맨 첫줄에 써야하므로..</div>
<div>super나 this는 static에서 사용할 수 없다.</div>
<div>static이 아닌 곳에서만 사용</div>
<div>
<hr /></div>
<h3><span style="color: #000000;">9장</span></h3>
<h2>Polymorphism(다형성)</h2>
<div>
<ol>
<li>객체 형변환</li>
<li>override method</li>
</ol>
</div>
<div>비교 연산자</div>
<div><strong><br />
</strong></div>
<div><strong>instanceof</strong></div>
<div>부모, 자식 형변환 가능한지 여부를 확인 true, false 를 리턴</div>
</div>
</div>
<div>
<hr /></div>
<div>Design Pattern + UML</div>
<div>임백준</div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/345/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-7강</title>
		<link>http://jongsunkim.pe.kr/archives/301</link>
		<comments>http://jongsunkim.pe.kr/archives/301#comments</comments>
		<pubDate>Thu, 31 Dec 2009 11:30:29 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=301</guid>
		<description><![CDATA[this() 같은 클래스 내에 생성자를 호출 생성자가 생성자로 redirect this()는 생성자 내에서 첫 줄에 와야한다. 어떤 문장도 this() 앞에 와서는 안된다. (예외는 주석) 일반 method에서는 호출할 수 없다. 성적관리프로그램 클래스를 파일로 나누기 Student Input Output Main Calc Sort Java.io.File Constructor summary에 File(String pathname) - Java에서 String parsing 방법 3가지 String class 의 split()를 이용하자 java.util.String [...]]]></description>
			<content:encoded><![CDATA[<h2><strong>this()</strong></h2>
<div></div>
<div>같은 클래스 내에 생성자를 호출</div>
<div>생성자가 생성자로 redirect</div>
<div>
<ul>
<li>this()는 생성자 내에서 첫 줄에 와야한다. 어떤 문장도 this() 앞에 와서는 안된다. (예외는 주석)</li>
<li>일반 method에서는 호출할 수 없다.</li>
</ul>
</div>
<h3>성적관리프로그램</h3>
<div>클래스를 파일로 나누기</div>
<div>
<ol>
<li>Student</li>
<li>Input</li>
<li>Output</li>
<li>Main</li>
<li>Calc</li>
<li>Sort</li>
</ol>
</div>
<div>Java.io.File</div>
<div>Constructor summary에</div>
<p>File(<a title="class in java.lang">String</a> pathname)</p>
<div>
<div>- Java에서 String parsing 방법 3가지</div>
<div>
<ol>
<li>String class 의 split()를 이용하자</li>
<li>java.util.String Tokenizer class를 이용하자</li>
<li>java.util.Scanner class를 이용하자</li>
</ol>
</div>
<div>1. split()</div>
</div>
<div>split은 기준(콤마, 스페이스 등등..)으로 나눈다.</div>
<div>기준은 정규식을 사용한다.</div>
<div>space = &#8220;\\s&#8221;</div>
<div>&#8220;\\s+&#8221; +가 붙은 것은 스페이스 한칸 이상을 뜻</div>
<div>변수는 가급적 private 메소드는 필요에 따라 private</div>
<h3></h3>
<h3></h3>
<h3>소멸자</h3>
<p>java.lang.Object</p>
<p>finalize</p>
<p><span style="font-size: x-small;"><br />
</span></p>
<p>Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.</p>
<p><span style="font-size: x-small;">A subclass overrides the </span><span style="font-size: x-small;">finalize</span><span style="font-size: x-small;"> method to dispose of system resources or to perform other cleanup.</span></p>
<p><span style="font-size: x-small;"><br />
</span></p>
<h3><strong>상속</strong></h3>
<p><span style="font-size: x-small;"><br />
</span></p>
<p><strong>Blog</strong></p>
<div><span style="font-size: small;"><a href="http://blog.doortts.com/119"><strong><span style="color: #000000;">Java의 static, 득과 실, 어떻게 사용할 것인가?</span></strong></a></span></div>
<div><a href="http://blog.doortts.com/119">http://blog.doortts.com/119</a></div>
<div>1997년 ~ 2002년 이전의 정보처리기사 기출문제</div>
<div>중 택 1</div>
<div>Java로 프로그래밍</div>
<div>http://archchez.tistory.com/728</div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/301/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-6강</title>
		<link>http://jongsunkim.pe.kr/archives/297</link>
		<comments>http://jongsunkim.pe.kr/archives/297#comments</comments>
		<pubDate>Wed, 30 Dec 2009 12:02:26 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=297</guid>
		<description><![CDATA[What&#8217; a Class? What&#8217;s an Object? an object is an instance of a class OOP Key Features Abstraction (추상화) 7장 Encapsulation (캡슐화) 7장 Inheritance (상속) 8장 Polymorphism (다형성) 9장 Abstraction 개념적 -&#62; 논리적 -&#62; 물리적 모델링 abstraction is selective ignorance Decide what is important and what is not loosely coupled &#8211; 느슨하게 연결된 Encapsulation abstraction을 [...]]]></description>
			<content:encoded><![CDATA[<h2>What&#8217; a Class?</h2>
<h2>What&#8217;s an Object?</h2>
<div>an object is an instance of a class</div>
<h3>OOP Key Features</h3>
<div>
<ul>
<li>Abstraction (추상화) 7장</li>
<li>Encapsulation (캡슐화) 7장</li>
<li>Inheritance (상속) 8장</li>
<li>Polymorphism (다형성) 9장</li>
</ul>
<h3>Abstraction</h3>
<div>개념적 -&gt; 논리적 -&gt; 물리적 모델링</div>
<div>abstraction is selective ignorance</div>
</div>
<p>Decide what is important and what is not</p>
<div>loosely coupled &#8211; 느슨하게 연결된</div>
<p><span style="font-size: medium;"><strong><span style="font-size: small;"><br />
</span></strong></span></p>
<p><strong><span style="font-size: small;">Encapsulation</span></strong></p>
<p>abstraction을 코드화</p>
<p>the principle of protecting sensitive parts of your objects from external manipulation</p>
<p>Hides the implementation details of a class</p>
<p>members can be <span style="text-decoration: underline;">public</span> or <span style="text-decoration: underline;">private</span></p>
<p>클래스 속 변수는 private &#8211; Java Bean에 규칙에 똑같이 적용됨.</p>
<div>example)</div>
<div>UML Diagram</div>
<div>
<div>
<table id="t08t" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="100%">클래스명</td>
</tr>
<tr>
<td width="100%">-변수</td>
</tr>
<tr>
<td width="100%">+메소드</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>- : private</div>
<div>+ : public</div>
<h3>Restricting Data Access</h3>
<div>Use modifiers to restrict data access:</div>
<div>- public</div>
<div>Everyone can use that part of the object</div>
<div>- private</div>
<div>No one outside the object&#8217;s class can use that part of the object</div>
<h3>Implementing Encapsulation</h3>
<div>Methods are public, accessible from the outside</div>
<div>Data is private, accessible only from the inside</div>
<h3>get Methods and set Methods</h3>
<h3>The this Reference</h3>
<div>The this keyword means &#8220;reference&#8221; to the same object</div>
<div>
<ol>
<li>this<span style="color: #ff0000;">.</span> &#8211; 나의</li>
<li>this &#8211; 나 자체</li>
<li>this() -</li>
</ol>
</div>
<div>나는 this 부모는 super</div>
<div>1. this.</div>
<div>명시적으로 구분할 때 this. 를 사용</div>
<div>멤버변수와 지역변수를 구분할 때</div>
<div>2. this</div>
<div>나 전체를 return할 때</div>
<h3>Creating Objects</h3>
<div>step1 : Allocating memory</div>
<div>step2 : Initializing the object by using a constructor</div>
<h3>Explicit Member Initialization</h3>
<div>명시적 초기화</div>
<div>int num = 5;</div>
<h3>Constructors</h3>
<div>
<ul>
<li>are special methods.</li>
<li>have no return type</li>
<li>have the same name as the class name</li>
<li>are called each time you create an object</li>
<li>you have been using a default constructor throughout most of the course</li>
<li>default constructor</li>
</ul>
<h3>Default Constructors</h3>
<div>all classes must have at least one constructor</div>
<div>the compiler provides a default constructor to any class which does not have an explicit constructor</div>
<div><strong>feature</strong></div>
<div>
<ul>
<li>public accessibility</li>
<li>same name as the class</li>
</ul>
<div>&#8230;</div>
<div>If a class has no constructor, a default constructor is inserted.</div>
<h3>Overriding the Default Constructor <span style="font-size: x-small;">(기본생성자의 재정의)</span></h3>
<div>The default constructor might be inappropriate</div>
<div>
<hr /></div>
<div>내일은 7장 마무리</div>
<div>this()</div>
<div>생성자에 대한 이야기</div>
<div>student class 나눠서 파일처리</div>
</div>
<div>sorting까지.</div>
</div>
<h3>Project</h3>
<div>documentation 70% / 개인코딩 10% / 디버깅 20%</div>
<div>
<hr /></div>
<h3>도서추천</h3>
<p>UMl도서</p>
<div><strong><span style="font-size: x-small;"><a href="http://www.yes24.com/24/goods/422266">UML, 실전에서는 이것만 쓴다!</a></span></strong></div>
<div><span style="font-family: 돋움, verdana;"><strong><br />
</strong></span></div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/297/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-5강</title>
		<link>http://jongsunkim.pe.kr/archives/295</link>
		<comments>http://jongsunkim.pe.kr/archives/295#comments</comments>
		<pubDate>Wed, 30 Dec 2009 12:01:45 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=295</guid>
		<description><![CDATA[Methods - call by name - call by value 2개 이상을 return 할 수 없음 2개 이상을 넘기고 싶으면 배열을 이용 value copy - call by reference 배열 reference type 을 이용 - variable argument runtime 때 size가 결정되는 배열을 사용 static void method(int &#8230; array) 배열의 기호는 쓰지 못하면서 배열의 기능 argument가 가변적(variable)이다. 갯수와 [...]]]></description>
			<content:encoded><![CDATA[<div>
<h3>Methods</h3>
</div>
<div>- call by name</div>
<p>- call by value</p>
<div>2개 이상을 return 할 수 없음</div>
<div>2개 이상을 넘기고 싶으면 배열을 이용</div>
<div>value copy</div>
<div>- call by reference</div>
<ul>
<li>배열</li>
<li>reference type</li>
</ul>
<div>을 이용</div>
<div>
<div id="n.0_"><img src="http://docs.google.com/File?id=dfgqhg63_28f2shmdgs_b" alt="" /></div>
</div>
<p>- variable argument</p>
<div>runtime 때 size가 결정되는 배열을 사용</div>
<div>
<ul>
<li>static void method(<strong>int &#8230; array</strong>)</li>
</ul>
</div>
<div>배열의 기호는 쓰지 못하면서 배열의 기능</div>
<div>argument가 가변적(variable)이다.</div>
<div>갯수와 타입을 신경안써도 된다.</div>
<p>method 호출 방법 4가지</p>
<div>call by name, call by value, call by reference, variable argument</div>
<div>
<div>
<table id="q:4y" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="100%">
<div>[modifiers] return_type method_name([parameter]){</div>
<div>method_body</div>
<div>}</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>String은 parameter로 쓰면 call by value</div>
<div>static void methodParameters(int n, String y){&#8230;}</div>
<div>
<hr /></div>
<h3>return</h3>
<div>return 아래 쪽에 어떤 문장도 허용하지 않는다.</div>
<div>
<div>
<hr /></div>
<div><span style="font-size: medium;"><strong><span style="font-size: small;"><br />
</span></strong></span></div>
<div><strong><span style="font-size: small;">Hello World 찍는 8가지 방법</span></strong></div>
<div>local variable 접근하 듯</div>
<div>주소를 통한 접근</div>
<div>클래스 이름으로 접근</div>
<div>주소로 접근하면 멤버변수</div>
<div>주소 없이 접근하면 스태틱</div>
<div>
<hr /></div>
<h3>recursive call</h3>
<h3>method overloading</h3>
<div>method 중복정의</div>
<div>overriding과는 차이 &#8211; method 재정의</div>
<div>이름이 같고 매개변수는 다르고</div>
<div>주소없이 코딩하기 위해 main은 static 이여야 한다.</div>
<div>new없이 쓸꺼냐 new있이 쓸꺼냐..</div>
<div>
<hr />
<h2>Object-Orientation</h2>
</div>
<div>eclipse 사용</div>
<div>UML</div>
<div>starUML을 이용해서 block diagram 생성, 기호</div>
<div><a href="http://staruml.sourceforge.net/ko/download.php">http://staruml.sourceforge.net/ko/download.php</a></div>
<div>
<hr /></div>
<h3>추천도서</h3>
</div>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/295/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java-4강</title>
		<link>http://jongsunkim.pe.kr/archives/293</link>
		<comments>http://jongsunkim.pe.kr/archives/293#comments</comments>
		<pubDate>Mon, 28 Dec 2009 12:12:53 +0000</pubDate>
		<dc:creator>Kim Jong-seon</dc:creator>
				<category><![CDATA[bitacademy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://jongsunkim.pe.kr/?p=293</guid>
		<description><![CDATA[12월 28일 월요일 / 4강 preview 자료형 &#8211; 기본형, 참조형 연산자 우선순위 조건문, 제어문 switch &#8211; char byte short int 표준입력 매개변수로 받는다. JOption.pane Scanner 꼭 알아야할 정렬 &#8211; 버블, 셀렉션, 삽입, 퀵 4장 반복문 Enhanced for Loop from Java 1.5 배열이나 collection 반복 횟수를 알 경우 for 반복 횟수를 모를 경우 while &#8211; eof(end [...]]]></description>
			<content:encoded><![CDATA[<h3>12월 28일 월요일 / 4강</h3>
<p><strong>preview</strong></p>
<p>자료형 &#8211; 기본형, 참조형<br />
연산자 우선순위<br />
조건문, 제어문</p>
<p>switch &#8211; char byte short int</p>
<p>표준입력<br />
매개변수로 받는다.<br />
JOption.pane<br />
Scanner</p>
<p>꼭 알아야할 정렬 &#8211; 버블, 셀렉션, 삽입, 퀵</p>
<h3><strong>4장 반복문</strong></h3>
<p>Enhanced for Loop from Java 1.5<br />
배열이나 collection</p>
<p>반복 횟수를 알 경우 for<br />
반복 횟수를 모를 경우 while &#8211; eof(end of file) 일 때까지</p>
<p>while</p>
<h4>The do Loop</h4>
<p>initialization;<br />
do {<br />
statment;<br />
update;<br />
}while(boolean expression);</p>
<p>Transfer of Control<br />
break [ label ];<br />
contune [ label ];<br />
label : statement;    // Where statement be any legal statement</p>
<p>다중 반복문 일때 label 사용<br />
단일 반복문은 에러발생.</p>
<p>ex) 최대공약수, 공배수, 소수출력</p>
<h3>5장 Arrays</h3>
<ul>
<li>같은 타입의 여러 값들을 모아둔 구조</li>
<li>배열은 객체</li>
<li>배열은 data structure</li>
<li>fixed-length</li>
<li>linked list를 객체화 한 것이 collection</li>
<li>collection은 타입이 달라도 됨 &#8211; 배열과의 차이점</li>
<li>collection은 사이즈 조절이 가능함 &#8211; 추가, 삭제</li>
<li>the array is created at runtime</li>
</ul>
<p>int [] array &lt;- 4byte 실제 주소는 heap에</p>
<p><strong>방법1</strong></p>
<p>선언 int [] array; // declaration, stack에 존재<br />
선언하면 4byte 사이즈가 만들어짐,<br />
int [] array = null;</p>
<p>생성<br />
array = new int[4];       // Construction, 배열은 객체이므로 new를 이용하여 생성<br />
실제로 heap에 int 형 배열(총 크기는 16byte)을 만들고 그 시작주소를 array에 저장.</p>
<p>할당<br />
array[0] = 5;    // assignment</p>
<p><strong>방법2</strong><br />
int [] array;    // declaration<br />
array = new int[]{3,4,5,6};        // Construction &amp; Assignment 대괄호 안에 인덱스 쓰면 안됨 방법3 int [] array = {3,4,5,6};        // initialization<br />
분리 불가능, 무조건 동일 line에서  컴파일러에 의해서 &#8211;&gt; array = new int[]{3,4,5,6}; 변환</p>
<h3>Declaring Arrays</h3>
<p>Reference Array</p>
<p>String [] array = {&#8220;Hello&#8221;, &#8220;world&#8221;, &#8220;Good&#8221;, &#8220;morning&#8221;};</p>
<p>각 방의 size가 무조건 4byte, reference type 이므로<br />
주소들의 배열</p>
<p>c의 double pointer</p>
<p>2차원 배열</p>
<p><strong>방법1</strong><br />
Rectangular Array<br />
ex) ArrayDemo3.java</p>
<p><strong>방법2</strong><br />
Jagged(Regged) Array &#8211; 가변배열, 불규칙배열<br />
ex) ArrayDemo4.java</p>
<p><strong>Copying Arrays</strong></p>
<p><strong>배열의 주소 복사</strong><br />
크기는 상관없음<br />
자료형 같아야함</p>
<p><strong>배열의 값 복사</strong><br />
!!크기 상관있음<br />
자료형 같아야함</p>
<p><strong>- Java API</strong></p>
<p>java.lang.System.arraycopy<br />
- public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)</p>
<p>ex)<br />
int [] array = {1,2,3,4,5};<br />
int [] array1 = {10,9,8,7,6,5,4,3,2,1};</p>
<p>System.out.println(&#8220;before array1[0] = &#8221; + array1[0]);<br />
System.arraycopy(array, 2, array1, 0, 3);	 // arraycopy를 이용한 배열의 값 복사<br />
System.out.println(&#8220;after array1[0] = &#8221; + array1[0]);</p>
<p>array[2] = 100;</p>
<p>System.out.println(&#8220;after array1[0] = &#8221; + array1[0]);</p>
<p><strong>sorting an array</strong><br />
- sort method<br />
bubble sort<br />
selection sort<br />
insert sort<br />
quick sort</p>
<p>bubble<br />
0&lt;=i<br />
0&lt;=j</p>
<p>- Java API<br />
java.util.Arrays.sort(); &#8211; quick sort<br />
단점 &#8211; 오름차순만 가능</p>
<p><strong>과제</strong></p>
<p>1. Japanki.java</p>
<p>Insert a money ? 145678<br />
5만원 : 2장<br />
1만원 : 4장<br />
5천원 : 1장<br />
1천원 : 0장<br />
500원 : 1개<br />
100원 : 1개<br />
50원 : 1개<br />
10원 : 2개<br />
5원 : 1개<br />
1원 : 3개</p>
<p>또(y/n) ?</p>
<p>while, do-while, for</p>
<h3>methods</h3>
<p>메서드의 필수 3요소<br />
이름<br />
괄호<br />
리턴타입</p>
<p>- call by name<br />
단점<br />
option이 없다. ex) makeSum();</p>
<p>- call by value<br />
값을 호출한다. ex) makeSum(50);, makeSum(10, 50);</p>
]]></content:encoded>
			<wfw:commentRss>http://jongsunkim.pe.kr/archives/293/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

