DB에 한 아이디로 여러번 좋아요 누르는 것을 방지하기 위해 liketable을 세움 좋아요를 눌렀을 때 liketable 을 insert 해주고 다시 좋아요를 눌러 취소했을 때 liketable을 delete 해줬다 CREATE SEQUENCE LIKE_SEQ START WITH 1 INCREMENT BY 1; CREATE TABLE LIKETABLE( SEQ NUMBER(8) PRIMARY KEY, BBS_CATEGORY NUMBER(8), //게시판 별로 번호 부여 TARGET_USER_SEQ NUMBER(8), // 유저의 시퀀스 값 FOREIGN KEY (TARGET_USER_SEQ) REFERENCES 유저테이블(seq), TARGET_BBS_SEQ NUMBER(8) // 좋아요를 누른 게시판..
String str = "홍길동--2001/03/14-서울시"; String split[] = str.split("-"); for (int i = 0; i >차이점 * split : null 문자를 같은 데이터 인정 * StringTokenizer : null문자를 같은 데이터 인정하지 않음 StringTokenizer st = new StringTokenizer(str, "-"); int len = st.countTokens(); System.out.println("len = " + len); System.out.println(st.nextToken()); Sy..
package encode; public class mainClass { public static void main(String[] args) { String str = "abc012"; String result, ori; result = encode(str); System.out.println(str + "를 암호화 : " + result); ori = code(result); System.out.println(result + "를 복호화 : " + ori); } // 암호화 static String encode(String src) { // 암호표 char abcCode[] = { // a ~ z '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')'..
package fibonnaci; public class mainClass { public static void main(String[] args) { // 피보나치 // 0 1 1 2 3 5 8 13 21 34 // a b c long a, b, c; long arrNum[] = new long [30]; int w = 0; a = 0; b = 1; arrNum[0] = a; arrNum[1] = b; while( w < 28) { c = a + b; arrNum[w+2] = c; a = b; b = c; w++; } for (int i = 0; i < arrNum.length; i++) { System.out.println("피보나치 수열 " + (i+1) + " 항 = " + arrNum[i]); ..
static void func(char c, int i, double d, String s) { c = (char)(int)(c + 32); // 97(a) - 65(A) c의 값 =A +32하면 아스킷 코드 97인데 이걸 다시 char 써서 문자로 변환 System.out.println("c = " + c); } public static void main(String[] args) { func('T', 1, 12.3, "Hello"); } static int charASCKeyValue(char c) { return (int)c; } public static void main(String[] args) { // 한문자를 넣으면 ASCII키 코드 값으로 리턴되어 나오도록 함수를 작성 char c = '0..
import java.util.Scanner; public class mainClass { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 계산기 String num1, num2, oper; int number1, number2; int result; int w; boolean suc; // init num1 = ""; num2 = ""; result = 0; oper = ""; w = 0; suc = true; // 입력 // String // number1 char c; boolean b = false; boolean out = true; while(out == true){ b = false; System..