본문 바로가기

Java/API3

SimpleDateFormat 이클립스 느낌표! To remove the warning just add Locale.getDefault() as the second argument while instantiating the date format object. Eg. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", java.util.Locale.getDefault()); 2015. 8. 4.
ArrayList 핵심정리 ArrayList 핵심정리 ArrayList.add() = 삽입 ArrayList.remove() = 삭제 ArrayList.indexOf() = 위치확인 ArrayList.isEmpty() = 비어있는지 확인 ArrayList.size() = 크기(원소의 개수) 확인 [일반 배열은 .length] ArrayList는 필요에 따라 그 크기가 동적으로 바뀐다. 객체를 추가하면 커지고 삭제하면 작아진다. ArrayList에 저장할 객체유형은 유형이름을 안에 집어넣는 형태의 유형 매개변수로 선언한다. (ArrayList 는 String유형의 객체만 넣을 수 있다.) ArrayList에는 원시유형의 값은 저장할 수 없고 일반 객체만 저장할 수 있지만, 컴파일러에서원시값을 Object 객체로 감싸고 그 객체를 원.. 2014. 12. 2.
[펌-http://sexy.pe.kr/tc/764][JAVA] 자바에서 실수값 반올림, 올림, 버림, 절대값 메서드 [JAVA] 자바에서 실수값 반올림, 올림, 버림, 절대값 메서드 자바 Math 클래스에서 실수값 반올림이나 올림, 버림, 절대값을 구해주는 메서드가 있다. 반올림 static long Math.round(double a) static int Math.round(float a) 예) System.out.println(Math.round(100.56)); //결과: 101 올림 static double ceil(double a) 예) System.out.println(Math.ceil(100.56)); //결과: 101.0 버림 static double floor(double a) 예) System.out.println(Math.floor(100.56)); //결과: 100.0 절대값 static doub.. 2014. 12. 1.