본문 바로가기

app/java

java Integer to int

Integer 는 int 의 wrapper 클래스이다.
JSP 에선 String를 Integer로 받은 다음 int 형으로 바꾼다.

String str = "123";
int i = Integer.parseInt(str);

if hashtable 로 받았다면 Integer로 받은 다음 intvalue()함수를 쓴다.

Hashtable ht = new Hashtable();
ht.put("test", new Integer("0000000000"));

Integer any = (Integer)ht.get("test");
int i = any.intValue();

'app > java' 카테고리의 다른 글

java 설치 에러 semi-colon found in selected path  (0) 2010.12.14
java 1.4 vector 5.0 vector 차이  (0) 2010.10.12
int, Integer 의 차이  (0) 2010.09.15
ubuntu android 설정하기!  (0) 2010.05.27
jar 파일 실행 시키기  (1) 2010.04.12