create table tbl_bbs (

  bbsno number,

  title varchar2(500) not null, 

  content varchar2(2000),

  writer varchar2(50),

  regdate date default sysdate,

  viewcnt number default 0

);


alter table tbl_bbs add CONSTRAINT

pk_bbs primary key (bbsno);


create sequence seq_bbs;


insert into tbl_bbs 

(bbsno, title, content, writer)

values (seq_bbs.nextval, '제목..14134525245245', '내용..34563623563456', 'user00');



--------------------------------------------------------------------------------------------


create table tbl_reply (

  replyno number not null,

  bbsno number not null,

  replyer varchar2(50) not null,

  reply varchar2(1000) not null,

  regdate date default sysdate,

  moddate date default sysdate

);


select * from tbl_reply;


alter table tbl_reply add CONSTRAINT

pk_reply primary key (replyno);


create sequence seq_reply;

insert into tbl_reply 

(REPLYNO, BBSNO, REPLYER, REPLY)

values (seq_reply.nextval, 1048577, '이XX', '박XX 바보');




create table tbl_store2 as (select * from tbl_store );

create table tbl_user2 as (select * from tbl_user );

create table tbl_menu2 as (select * from tbl_menu );

create table tbl_review2 as (select * from tbl_review );

Posted by 타다키치
,

select

qno, min(question), min(answer),

max(decode(opnum,1,optionstr,'')) op1,

max(decode(opnum,2,optionstr,'')) op2,

max(decode(opnum,3,optionstr,'')) op3,

max(decode(opnum,4,optionstr,'')) op4

from tbl_quiz, tbl_option

where qno = quizno(+)

group by qno;

Posted by 타다키치
,

문자-->더블로

double tempNum=Double.parseDouble(scanner.nextLine());


Integer-->문자

String numStr2 = String.valueOf(numInt);


프로퍼티 생성

Properties prop = new Properties();

prop.load(new FileInputStream(fileName));


이터레이터 생성

Iterator<?> names = prop.keySet().iterator();


이터레이터 반복 예제

while(names.hasNext()){

String key = (String)names.next();

String value=(String)prop.get(key);

}


StringBuilder 예제

String listForHtml=null;

StringBuilder builder = new StringBuilder();

builder.append("<ul>");

for (String string : this.songList) {

builder.append("<li>");

builder.append("<a href='listen.htm?file="+ string +"'>");

builder.append(string);

builder.append("</a>");

builder.append("</li>");

}

builder.append("</ul>");

listForHtml=builder.toString();



한 줄로 클래스 생성(newInstance)

IUIMenu menu = (IUIMenu)Class.forName(value).newInstance();


파일 인풋으로 한 줄씩 읽는 예제(Scanner)

public LinkedList<IQuizVO> makeQuizList() throws Exception{

InputStream input = new FileInputStream("c:\\zzz\\quiz.txt");

scanner = new Scanner(input);

while (true){

try {

String s = scanner.nextLine();

String[] array=s.split(",");

} catch (Exception e) {

break;

}

}

return this.quizlist;

}


문장 만들어서 파일 아웃풋으로 저장하는 예제(\n 중요)

OutputStream out = new FileOutputStream("c:\\zzz\\quizout.txt");

byte[] toByte;

String sen = i.getCategory()+","+i.getNum()+","+i.getQuestion()+","+i.getAnswer()+"\n";

toByte=sen.getBytes();

out.write(toByte);

out.close();


Instance of 예제

if(this.question instanceof ObjectiveQuiz){}


접근제한자

public: 모든 외부

protected: 동일 패키지+다른 패키지라도 상속 시

default: 동일 패키지

private: 같은 클래스 내에서만


스태틱 예제

public abstract class agentlet  {

static Map<String, String> mimeMap;

protected static String ROOT  = "c:\\zzz\\mp3";

static{

mimeMap = new HashMap<String, String>();

mimeMap.put("mp3", "audio/mpeg3");

}

}

Posted by 타다키치
,