본문 바로가기

Study/Programming

(82)
자바 달력 import java.util.*; public class Cal { public static void main(String[] args){ // int year = Integer.parseInt(args[0]); // int month = Integer.parseInt(args[1]); int year = 2009; int month = 4; Calendar fDay = Calendar.getInstance(); Calendar lDay = Calendar.getInstance(); fDay.set(year, month-1, 1); lDay.set(year, month-1, 0);//날짜입력 부분에 0을 입력하면 그 달의 마지막 값을 리턴 int START_DAY_OF_WEEK = fDay.get(Ca..
자바 컬렉션 프레임워크 import java.util.ArrayList; public class ListEx1 { public static void main(String[] agrs){ ArrayList ar1 = new ArrayList(); ArrayList ar2 = new ArrayList(100); ar1.add(1); ar1.add(new Integer(2)); //데이터의 갯수 System.out.println("ArrayList 사이즈 : " +ar1.size()); for(int i=0; i=0; i--){ if(list1.contains(list2.get(i))) list2.remove(i); } print(list1, list2); } static void print(ArrayList list1, Array..
자바 예외처리 //args[0] = abc; public class ExceptionEx1{ public static void main(String[] args){ int i =0; try{ i = Integer.parseInt(args[0]); }catch(NumberFormatException e){ //Exception 발생했을 때만 실행되는 구문 System.out.println("Exception 내부에서 실행"); } System.out.println(i); } } //args[0] = abc; public class ExceptionEx1{ public static void main(String[] args){ int i =0; try{ i = Integer.parseInt(args[0]); }catch(..
자바스크립트 ID 저장, 중복체크 아이디 : 이름 : 비밀번호 : 비번확인 :
자바스크립트 달력 2008년 2009년 1월 2월 3월 4월 5월
자바 Array public class ArrayEx2{ public static void main(String[] args){ int[] score = { 79, 88, 91, 33, 100, 55, 95}; int max = score[0]; int min = score[0]; for(int i=1; i max){ max = score[i]; } if(score[i] < min){ max = score[i]; } } System.out.println("최대값 : " +max); System.out.println("최소값 : " +min); } } public class ArrayEx10 { public static void main(String[] args){ int[][] score = {{ 100, 100, 10..
자바 String, StringBuffer package p1; public class StringEx8 { public static void main(String[] args){ String[] numbers = { "1", "2", "3", "4", "5"}; String result1 = ""; int result2 = 0; for(int i=0; i
자바 equals public class equals { public static void main(String[] args){ Value v1 = new Value(10); Value v2 = new Value(10); String s1 = new String("10"); String s2 = new String("10"); //Object equals 메서드 //equals 내용 값이 아니라 참조변수 값만 비교 if(v1 == v2){ System.out.println("v1과 v2는 같습니다."+v1+" "+v2); }else{ System.out.println("v1과 v2는 다릅니다."+v1+" "+v2); } if(v1.equals(v2)){ System.out.println("v1과 v2는 같습니다."+v1+..