package Query; import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement; public class CRUDTest {Connection con; static {try {Class.forName("oracle.jdbc.driver.OracleDriver");// JDBC 드라이버 클래스 네임} catch (ClassNotFoundException cne) {cne.printStackTrace();// jar 파일이 존재하지 않을 경우}} public void connect() { // 연결 메소드try {co..
package practice; import java.util.HashSet;import java.util.Iterator; public class HashSetEx5 { public static void main(String[] args) {// TODO Auto-generated method stubHashSet setA = new HashSet();HashSet setB = new HashSet();HashSet setHab = new HashSet();HashSet setKyo = new HashSet();HashSet setCha = new HashSet(); setA.add("1");setA.add("2");setA.add("3");setA.add("4");setA.add("5");System..
package practice; import java.util.Collections;import java.util.HashSet;import java.util.LinkedList;import java.util.List;import java.util.Set; public class HashSetLotto { public static void main(String[] args) {// TODO Auto-generated method stub Set set = new HashSet();// 해쉬셋을 인스턴스로 갖는 셋 참조변수 생성 (다형성) for (int i = 0; set.size() < 6; i++) {int num = (int) (Math.random() * 45) + 1;// 임의의 1~45 사이의..
package practice; import java.util.HashSet;import java.util.Set; public class HashSetEx1 { public static void main(String[] args) {// TODO Auto-generated method stub Object[] objArr = { "1", new Integer(1), "2", "2", "3", "3", "4", "4","4" };Set set = new HashSet(); // 해쉬셋 생성// Set set = new LinkedHashSet(); //해쉬셋 생성(정렬된 데이터) for (int i = 0; i < objArr.length; i++) {set.add(objArr[i]);// 중복되는 값을..
package practice; import java.util.ArrayList;import java.util.ListIterator; public class ListIteratorEx1 { public static void main(String[] args) {// TODO Auto-generated method stub ArrayList list = new ArrayList();list.add("1");list.add("2");list.add("3");list.add("4");list.add("5"); ListIterator it = list.listIterator();// 리스트 이터레이터 객체 생성 while (it.hasNext()) {System.out.println(it.next());// ..
package practice; import java.util.ArrayList;import java.util.Iterator; public class IteratorEx1 { public static void main(String[] args) {// TODO Auto-generated method stub ArrayList list = new ArrayList();list.add("1");list.add("2");list.add("3");list.add("4");list.add("5");//ArrayList 생성 및 객체 추가 Iterator it = list.iterator();//이터레이터 생성while (it.hasNext()) {Object obj = it.next(); //다음 객체를 읽음,..
package practice; import java.util.ArrayList;import java.util.LinkedList;import java.util.List; public class ArrayLinkedListTest { public static void main(String[] args) {// TODO Auto-generated method stub //각각의 삽입, 삭제 메소드의 시간을 측정하는 프로그램ArrayList al = new ArrayList(1000000);LinkedList ll = new LinkedList(); System.out.println("== 순차적으로 추가하기 =="); System.out.println("ArrayList : " + add1(al));Sys..
package practice; import java.util.Arrays; public class CopyTest { public static void main(String[] args) {// TODO Auto-generated method stub int[] data = { 0, 1, 2, 3, 4 };int[] sCopy = null;int[] dCopy = null; sCopy = shallowCopy(data); //얕은 복사, 원본이 바뀌면 바뀜dCopy = deepCopy(data); //깊은 복사, 원본과 관계 없이 진짜 데이터를 복사 System.out.println("Original:" + Arrays.toString(data));System.out.println("Shallow:" ..