This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChildBook implements Book{ | |
private final int code=1; | |
private final int point=1000; | |
@Override | |
public int priceCode(){ | |
return this.code; | |
} | |
@Override | |
public int getPointPercent(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Book{ | |
int priceCode(); | |
int getPointPercent(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//catch 블록을 비우면 예외는 무시된다.-이상한코드... | |
try{ | |
.... | |
} catch (someException e){ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Object pop(){ | |
if(size==0) | |
throw new EmptyStackException(); | |
Object result = element[--size]; | |
... | |
//기타코드 | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IndexOutOfBoundsException(int lowerBound, int upperBound, int index){ | |
//파라미터로 부터 오류를 알 수 있는 상세한 메시지 작성 | |
super("Lower bound: "+lowerBound + | |
", Upper bound: "+upperBound + | |
", Index: "+index); | |
//프로그램에서 이용할 수 있도록 오류 정보보관 | |
this.lowerBound = lowerBound; | |
this.upperBound = upperBound; | |
this.index = index; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(obj.fileIOPermitted(args)){ | |
obj.fileIO(args); | |
}else{ | |
//예외사항 처리... | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
obj.fileIO(args); | |
}catch(FileInputOutputException e){ | |
//예외사항 처리... | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
public class TestExceptionPerformance { | |
public static void main(String[] args) { | |
int count[] = new int[100000]; | |
long startTime = System.currentTimeMillis(); | |
for (int i = 0; i < count.length; i++) { count[i]++; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
public class TestExceptionPerformance { | |
public static void main(String[] args) { | |
int count[] = new int[100000]; | |
long startTime = System.currentTimeMillis(); | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
int i = 0; | |
while(true) | |
personArray[i++].addCount(); | |
}catch(ArrayIndexOutOfBoundsException e){ | |
} |