목록전체 글 (37)
mangocoder
1. java main 실행 했을때 MemberFC.service(null, ?); 1-2 MemberFC static void service(String cmd, ?){ Action action = ActionMapper.getInstance().getAction(cmd); Frame next=action.execute(?); next.setVisible(true); } 1-3 ActionMapper static{ commands.put("menu", new NullAction(new MenuForm())); commands.put("list", new ListAction(new ListForm())); } static ActionMapper getInstance(){return instance;} A..
oracleDB에 로그인 : class DBUtil import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; class DBUtil { public static Connection getConnection() { Connection conn = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@localhost:1521:xe"; String id = "scott"; String pass = "tiger"; conn = DriverManager.g..
컬렉션 : 자료구조 데이터를 저장하는 방식 배열은 순차적으로 저장, 중복된 데이터를 저장할 수 있다. Set 컬렉션 클래스 : 순서가 없다. 중복된 데이터 허용X 1. HashSet 요소를 순서에 상관없이 저장, 중복된 값은 저장X HashSet hs01 = new HashSet(); HashSet hs02 = new HashSet(); 2. TreeSet 컬렉션 클래스 - 요소를 순서에 상관없이 저장, 중복된 값 저장 X, 작은값부터 순서대로 정렬함 TreeSet ts = new TreeSet(); ts.add(30); ts.add(40); Set 메소드 add() 메소드 : 객체에 요소를 저장 // add() 메소드를 이용한 요소의 저장 hs01.add("홍길동"); hs01.add("이순신"); S..
Exception, try{}catch(){} Exception class A{ public static void main(String[] args) throws Exception{ Exception e = new Exception("폭탄"); throw e; //throw뒤에는 Exception클래스만 올 수 있다. } } 예외처리기 만들기 : try{}catch(Exception e){} class A { public static void main(String... args) { try { Exception e = new Exception("폭탄"); throw e; //e가 던져졌으므로 } catch (Exception e) { System.out.println("예외처리부분"); //catch가 ..