C구문의 전처리 구문인 #ifdef나 #ifndef같은 넘을 자바에서 사용하는 기본적인 내용입니다.
아래처럼 println이 DEF가 정의되었냐 혹은 DEBUG모드냐에 따라 달라지는 형태로 되어 있는 구문인 경우
아래처럼, 바꿔주면 됩니다.
아래처럼 println이 DEF가 정의되었냐 혹은 DEBUG모드냐에 따라 달라지는 형태로 되어 있는 구문인 경우
public class IFDef{
public IFDef(){
int i = 100;
#ifdef DEF
System.out.println("DEF");
#else
System.out.println("not DEF");
#endif
}
}
public IFDef(){
int i = 100;
#ifdef DEF
System.out.println("DEF");
#else
System.out.println("not DEF");
#endif
}
}
아래처럼, 바꿔주면 됩니다.
private static final boolean def = false;
if (def) {
System.out.println("DEF");
} else {
System.out.println("not DEF");
}
if (def) {
System.out.println("DEF");
} else {
System.out.println("not DEF");
}
'Java' 카테고리의 다른 글
| JDBC Type 별 내용 (0) | 2010/06/25 |
|---|---|
| 외부 API를 JDK에서 내포한 경우, 최신의 외부 API 사용하기.. (0) | 2010/06/22 |
| #ifdef #ifndef in Java (0) | 2010/06/15 |
| 멀티쓰레드 프로그램 평가기준 (0) | 2010/06/01 |
| 간단한 SOAP 메시지 콜 (0) | 2010/05/26 |