1. 최초 확인한곳..
http://code.google.com/p/mybatis/issues/detail?id=21&colspec=ID%20Type%20Component%20Status%20Priority%20Version%20Target%20Summary%20Reporter


2.  DTD 적용 확인,  
 http://mybatis.org/dtd/mybatis-3-mapper.dtd

3. 
3.1.0 SNAPSHOT 다운로드 / http://code.google.com/p/mybatis/wiki/Downloads?tm=2

4. 사용법

public static SqlSessionFactory sqlMapper = MyBatisManager.getInstance();
System.out.println(  sqlMapper.getConfiguration().getDatabaseId() ); 

등으로 DatabaseId 확인...


testMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper

PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

"http://mybatis.org/dtd/mybatis-3-mapper.dtd">


<mapper namespace="testMapper">


<!-- DB2 용 -->

<select id="getUserId" resultType="HashMap" databaseId="DB2/AIX64">

SELECT * FROM DB2_TABLE

</select>

<!-- CUBRID 용-->

<select id="getUserId" resultType="HashMap" databaseId="CUBRID">

SELECT * FROM CUBRID_TABLE

</select>


<!-- databaseId가 정의가 안되었을시... -->

<select id="getUserId" resultType="HashMap">

SELECT * FROM ETC_TABLE

</select>
 

</mapper>

 

in Java...

list = session.selectList("testMapper.getUserId");
일상적으로 사용... 

 
 
 
저작자 표시
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/302 관련글 쓰기

댓글을 달아 주세요



원인
참조하고 있는 Tomcat 경로가 변경되었을시에 발생


해결

이클립스 종료후
Workspace로 이동후.

.metadata/.plugins/org.eclipse.core.runtime/.settings 를 열어 보면
org.eclipse.wst.server.core.prefs org.eclipse.jst.server.tomcat.core.prefs 파일을 삭제!

이클립스 시작후 재 등록





출처 : http://forums.sun.com/thread.jspa?threadID=5368347
저작자 표시
Posted by 싸구려코드
TAG Java

Trackback Address :: http://sarangsai.com/trackback/277 관련글 쓰기

댓글을 달아 주세요



 import groovy.sql.Sql
class A {
  static void main(String[] args) {

    def sql = Sql.newInstance("jdbc:db2://아이피:50000/데이터베이스명", "아이디","비밀번호", "com.ibm.db2.jcc.DB2Driver")
    sql.eachRow("select * from TABLENAME "){
      println it.컬럼명 + " ${it.컬럼명}"

    }
  }
}




심플
저작자 표시
Posted by 싸구려코드
TAG DB2, Groovy, JDBC

Trackback Address :: http://sarangsai.com/trackback/235 관련글 쓰기

댓글을 달아 주세요


-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=????(포트 숫자)
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Posted by 싸구려코드
TAG JConsole

Trackback Address :: http://sarangsai.com/trackback/220 관련글 쓰기

댓글을 달아 주세요


JSP에서 매번 System.out.println() 해서 tomcat의 catalina.log 등을 tail 등으로 감시하면서 개발을 하다.
ibatis + log4j 를 이용하여 쿼리를 디버깅 하던중...
binding (?) 된 값을을 볼수 없을까 하고 찾아 보던중...

log4sql 을 발견!!!

기존 jdbc driver를 변경만 해주면 멋진 log들이...

com.ibm.db2.jcc.DB2Driver -> core.log.jdbc.driver.DB2Driver


URL : http://log4sql.sourceforge.net/index_kr.html
개발하신분 블로그 : http://jquery.egloos.com/

제작하신 만든분 정말 감사합니다.!

참고 블로그 : http://westzero.net/16

Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/216 관련글 쓰기

댓글을 달아 주세요

AMChart 를 PNG 파일로 저장하는 코드...
org.jfree.chart.ChartUtilities의 writeBufferedImageAsPNG 이용...






amchart의 setting 파일에 다음 내용 추가...
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/208 관련글 쓰기

댓글을 달아 주세요

  HashMap hashmap = new HashMap();

  Collection coll = hashmap.values();
  Iterator iter = coll.iterator();
  while (iter.hasNext()) {
    Object obj = iter.next();
  }

Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/193 관련글 쓰기

댓글을 달아 주세요

제9회 한국 자바 개발자 컨퍼런스 ...

제9회 글자와 밑에 스폰서만 바꾼 현수막...?

사전등록 확인 코너에 줄을 서서 대기하시는 분들.. 언제 받으려나...

여러 부스에서 경품을 받을려고 줄을 서 있는분들 ...
작년보다 더 많은거 같았다.

미리 착석해 계신분들... 자리가 없을 정도 (그래도 밖엔 사람들 많았음)

받은 책자...
지난회 보다 두꺼워 졌다~.


개선했으면 하는점...
1. 수용인원이 너무 부족한 장소 (제일 먼저 바뀌어야 되는 상황) 자바 개발자가 늘어가는 상황과 8회와는 다르게 블로그를 통한 홍보 이벤트 까지 했으니 더 많은 인원이 참관하는건 당연지사, 그걸 알면서 행사를 개최..
수많은 협찬사는 부록??....

2. 외부 업체 부스에서 자바 개발자라면 가입되어있을만한 (OTN/SunDeveloperNetworks)에 신규가입 이벤트를 진행하는건 아이러니?
- 중복가입하는건 센스?
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/181 관련글 쓰기

댓글을 달아 주세요

  1. Favicon of http://dev.heartsavior.net BlogIcon Heart 2008/02/17 10:02 Address Modify/Delete Reply

    사람 수에 비해 장소가 참( -_-;; ) 좁았죠.
    근데 작년 10월에는 건대에서 했는데 행사장 반도 안차는 상황이...
    '그것때문에 JCO 측에서 인원 수 추산을 잘못 한 게 아닐까' 라고 생각해 봅니다.

    • Favicon of http://sarangsai.com BlogIcon playok 2008/02/17 23:09 Address Modify/Delete

      제가 8회 컨퍼런스도 참관했지만 그때도 인원이 많았었습니다. 그리고 일부 섹션에 쏠림현상도 있었구요. 10월에 한건 오픈소스컨퍼런스로 알고 있어서 이번것과는 상관이 없다고 생각됩니다.^^


SpinnerModel model =
new SpinnerNumberModel(0, // 초기값
                0,        // 최소값
              100,        // 최대값
                1);       // 증가값
JSpinner spinner = new JSpinner(model);


'Computer/IT > JAVA' 카테고리의 다른 글

HashMap -> Collection -> Iterator  (0) 2008/05/19
제9회 자바 개발자 컨퍼런스 참관  (2) 2008/02/16
JAVA JSpinner Number 사용법  (0) 2008/01/02
ECLIPSE - eclipse.ini 실행옵션  (0) 2007/12/06
Servlet to Applet (Echo) Example  (0) 2007/11/23
Eclipse - JAD Pluggin  (0) 2007/11/19
Posted by 싸구려코드
TAG Java, JSpinner

Trackback Address :: http://sarangsai.com/trackback/170 관련글 쓰기

댓글을 달아 주세요

-showsplash
org.eclipse.platform

-vmargs
-Xverify:none
-XX:+UseParallelGC
-XX:PermSize=64M
-XX:MaxPermSize=128M
-XX:MaxNewSize=64M
-XX:NewSize=64M
-Xms512m
-Xmx512m

'Computer/IT > JAVA' 카테고리의 다른 글

제9회 자바 개발자 컨퍼런스 참관  (2) 2008/02/16
JAVA JSpinner Number 사용법  (0) 2008/01/02
ECLIPSE - eclipse.ini 실행옵션  (0) 2007/12/06
Servlet to Applet (Echo) Example  (0) 2007/11/23
Eclipse - JAD Pluggin  (0) 2007/11/19
[SWT] 기본적인 Hello Window  (0) 2007/08/13
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/166 관련글 쓰기

댓글을 달아 주세요

Servlet to Applet (Echo)  Example

http://www.frank-buss.de/echoservlet/

'Computer/IT > JAVA' 카테고리의 다른 글

JAVA JSpinner Number 사용법  (0) 2008/01/02
ECLIPSE - eclipse.ini 실행옵션  (0) 2007/12/06
Servlet to Applet (Echo) Example  (0) 2007/11/23
Eclipse - JAD Pluggin  (0) 2007/11/19
[SWT] 기본적인 Hello Window  (0) 2007/08/13
[java5] Calendar Example - 년 월 일 시 분 초  (0) 2006/09/28
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/165 관련글 쓰기

댓글을 달아 주세요

다운받을수 있는 사이트..


SourceForge - JAD
http://sourceforge.net/project/showfiles.php?group_id=40205


Wki
http://jadclipse.sourceforge.net/wiki/index.php/Main_Page#Download


사용법 :
ex)
1번째
http://www.kpdus.com/jad.html 에서
해당 OS의 JAD. 파일을 다운 받아 PATH가 설정된 곳에 위치

2번째
net.sf.jadclipse_3.3.0.jar ->Eclipse/plugins에 Jar File을 Extract 함.

Eclipse 의 Window->Preferences 선택
사용자 삽입 이미지

Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/163 관련글 쓰기

댓글을 달아 주세요


import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;


public class HelloSwtWindow {

        public static void main(String[] args) {
                Display display = new Display();
               
                Shell shell = new Shell(display);
                shell.setText("My SWT window");
               
                shell.open();
               
                while(!shell.isDisposed())
                {
                        if(!display.readAndDispatch())
                        {
                                display.sleep();
                        }
                }
               
                display.dispose();
        }

}

파일명 : HelloSwtWindow.java


실행결과

실행결과


Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/139 관련글 쓰기

댓글을 달아 주세요

 
  1. import java.util.Calendar;
  2. import java.util.Date;
  3. class CalendarExam {
  4.   public static void main(String args[]) {
  5.     Calendar calendar = Calendar.getInstance();
  6.    
  7.     System.out.print( calendar.get(Calendar.YEAR) + "년  ");
  8.    
  9.     System.out.print( calendar.get(Calendar.MONTH)+1 + "월  ");
  10.    
  11.     System.out.print( calendar.get(Calendar.DAY_OF_MONTH) + "일  ");
  12.     System.out.print( calendar.get(Calendar.HOUR) + "시 ");
  13.    
  14.     System.out.print( calendar.get(Calendar.MINUTE) + "분 ");
  15.    
  16.     System.out.print( calendar.get(Calendar.SECOND) + "초 ");
  17.    
  18.     System.out.print( calendar.get(Calendar.DAY_OF_MONTH) + "일  ");
  19.   }
  20. }
 
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/96 관련글 쓰기

댓글을 달아 주세요

 
  1. import java.io.File;

  2. public class FileInfo
  3. {
  4.   public static void main(String args[])
  5.   {
  6.     if(args.length!=1) {
  7.       System.out.println(" ex) : java FileInfo <파일이름>" );
  8.       System.exit(1);
  9.     }
  10.    
  11.     File infoFile = new File(args[0]);
  12.    
  13.     if(infoFile.exists()) {
  14.       System.out.println("파일이름 : " + infoFile.getName());
  15.       System.out.println("상대경로 : " + infoFile.getPath());
  16.       System.out.println("절대경로 : " + infoFile.getAbsolutePath());
  17.       System.out.println("쓰기가능 : " + infoFile.canWrite());
  18.       System.out.println("읽기가능 : " + infoFile.canRead());
  19.       System.out.println("숨은파일 : " + infoFile.isHidden());
  20.       System.out.println("파    일 : " + infoFile.isFile());
  21.       System.out.println("디렉토리 : " + infoFile.isDirectory());
  22.       System.out.println("파일크기 : " + infoFile.length() + "Byte");
  23.       System.out.println("최종수정 : " + infoFile.lastModified());
  24.     } else {
  25.       System.out.println("파일이 없습니다.");
  26.     }
  27.   }
  28. }

Posted by 싸구려코드
TAG file i/o, Java

Trackback Address :: http://sarangsai.com/trackback/95 관련글 쓰기

댓글을 달아 주세요

버튼을 생성하여 컨테이너 애플릿에 붙인뒤 이벤트 처리
  1. import java.awt.*;
  2. import java.applet.*;
  3. import java.awt.event.*;
  4. public class ButtonExam extends Applet implements ActionListener
  5. {
  6.   Label myLabel;
  7.   Button myButton1, myButton2, myButton3;
  8.   public void init()
  9.   {
  10.     myButton1 = new Button();
  11.     myButton1.setLabel("C언어");
  12.     myButton1.addActionListener(this);
  13.     add(myButton1);
  14.     myButton2 = new Button("C++언어");
  15.     myButton2.addActionListener(this);
  16.     add(myButton2);
  17.    
  18.     myButton3 = new Button("자바");
  19.     myButton3.addActionListener(this);
  20.     add(myButton3);
  21.    
  22.     myLabel = new Label();
  23.     myLabel.setText("버튼을 눌러주세요!");
  24.     myLabel.setAlignment(Label.CENTER);
  25.     myLabel.setBackground(Color.yellow);
  26.     add(myLabel);
  27.   }
  28.   public void actionPerformed(ActionEvent e)
  29.   {
  30.     if(e.getSource() == myButton1) {
  31.       myLabel.setText("선택 : C언어");
  32.     } else if(e.getSource()==myButton2) {
  33.       myLabel.setText("선택 : C++언어");
  34.     } else if(e.getSource()==myButton3) {
  35.       myLabel.setText("선택 : 자바");
  36.     }
  37.   }
  38. }

Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/88 관련글 쓰기

댓글을 달아 주세요

  레이블을 생성하여 Applet 컨테이너에 붙이는 Example
  1. import java.awt.*;
  2. import java.applet.*;
  3. public class LabelExam extends Applet
  4. {
  5.   Label myLabel1, myLabel2, myLabel3;
  6.   public void init()
  7.   {
  8.     myLabel1 = new Label();
  9.     myLabel1.setText("Label 테스트 프로그램");
  10.     myLabel1.setAlignment(Label.LEFT);
  11.     myLabel1.setBackground(Color.cyan);
  12.     add(myLabel1);
  13.   }
  14. }

Posted by 싸구려코드
TAG AWT, Java, Label

Trackback Address :: http://sarangsai.com/trackback/87 관련글 쓰기

댓글을 달아 주세요

방향키를 이용해 button 움직이기

파일명 : KeyEvent1.java
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. public class KeyEvent1 extends Frame {
  4.   Button man;
  5.   public KeyEvent1(String title) {
  6.     super(title);
  7.     setLayout(null);
  8.     this.setSize(200, 200);
  9.    
  10.     man = new Button("Man");
  11.     man.setBounds(100, 100, 40, 20);
  12.     man.setBackground(Color.BLUE);
  13.     man.setForeground(Color.WHITE);
  14.     this.add(man);
  15.     man.addKeyListener(new KeyHandler());
  16.   }
  17.   public static void main(String args[]) {
  18.     KeyEvent1 me = new KeyEvent1(" Key 이벤트 활용 ");
  19.     me.setVisible(true);
  20.   }
  21.   class KeyHandler extends KeyAdapter {
  22.     public void keyPressed(KeyEvent e) {
  23.       String direction = e.getKeyText(e.getKeyCode());
  24.       System.out.println(direction);
  25.       int x=man.getX();
  26.       int y=man.getY();
  27.      
  28.       if(direction.equals("Right")) x+=10;
  29.       else if(direction.equals("Left")) x-=10;
  30.       else if(direction.equals("Down")) y+=10;
  31.       else if(direction.equals("Up")) y-=10;
  32.      
  33.       man.setLocation(x, y);
  34.     }
  35.   }
  36. }
 

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA] APPLET - ButtonEvent  (0) 2006/09/18
[JAVA] APPLET - Label 사용예제  (0) 2006/09/18
[JAVA5] 방향키를 이용해 button 움직이기  (0) 2006/09/14
[JAVA5] ActionEvent Example  (0) 2006/09/14
[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/84 관련글 쓰기

  1. Subject: 방향키를 이용해 button 움직이기

    Tracked from 광아의 프로그래밍 2006/09/17 13:17  Delete

    파일명 : KeyEvent1.java import java.awt.*;import java.awt.event.*;public class KeyEvent1 extends Frame { Button man; public KeyEvent1(String title) { super(title); setLayout(null); this.setSize(200, 200); man = new Button("Man"); man.setBounds(100, 100, 40..

댓글을 달아 주세요

TextField 의 내용을 Console로 출력한다.

파일명 : ActionEvent1.java
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. public class ActionEvent1 extends Frame implements ActionListener {
  4.   TextField tf;
  5.   public ActionEvent1(String title) {
  6.     super(title);
  7.     tf=new TextField(20);
  8.    
  9.     // this는 Frame이면서, ActionListener 객체이다.
  10.     tf.addActionListener(this);
  11.    
  12.     //  텍스트 필드를 프레임(this)에 추가한다.
  13.     add(tf);   
  14.   }
  15.   public void actionPerformed(ActionEvent e) {
  16.     // 이벤트 소스가 TextField형 객체이면
  17.     if(e.getSource() instanceof TextField) {
  18.      
  19.       // 이벤트 소스를 가져온다.
  20.       TextField temp = (TextField)e.getSource();
  21.       // 화면에 temp의 문자열 출력
  22.       System.out.println(temp.getText());
  23.      
  24.       // temp의 내용을 지운다.  
  25.       temp.setText("");
  26.     }
  27.   }
  28.   public static void main(String args[]) {
  29.     ActionEvent1 me = new ActionEvent1("액션 이벤트 처리");
  30.     me.pack();
  31.     me.setVisible(true);
  32.   }
  33. }
 

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA] APPLET - Label 사용예제  (0) 2006/09/18
[JAVA5] 방향키를 이용해 button 움직이기  (0) 2006/09/14
[JAVA5] ActionEvent Example  (0) 2006/09/14
[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/83 관련글 쓰기

댓글을 달아 주세요

  1. import java.net.*;
  2. class AddressTest {
  3.   public static void main(String args[])
  4.   {
  5.    
  6.     try
  7.     {
  8.       InetAddress Address = InetAddress.getLocalHost();
  9.      
  10.       System.out.println("로컬 컴퓨터의 이름 : "
  11.                   + Address.getHostName() );
  12.       System.out.println("로컬 컴퓨터의 IP : "
  13.                   + Address.getHostAddress() );
  14.       Address = InetAddress.getByName("java.sun.com");
  15.       System.out.println("java.sun.com 컴퓨터의 이름과 IP 주소 : "
  16.                   + Address);
  17.       InetAddress SW[] = InetAddress.getAllByName("www.naver.com");
  18.      
  19.       for(int i=0; i<SW.length; i++)
  20.       {
  21.         System.out.println(SW[i]);
  22.       }
  23.     }
  24.    
  25.     catch (UnknownHostException e)
  26.     {
  27.       System.out.println("알수없는 호스트");
  28.     }
  29.              
  30.   }
  31. }
 

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA5] 방향키를 이용해 button 움직이기  (0) 2006/09/14
[JAVA5] ActionEvent Example  (0) 2006/09/14
[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/82 관련글 쓰기

댓글을 달아 주세요

[CODE type="java"]
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.IOException;

public class Grading
{

  private void mCTA()
  {

   BufferedReader br;
   StringTokenizer st=null;
   int i=0;
   int[] iArr= new int[10];

   System.out.print("Input ? ");

   br = new BufferedReader(new InputStreamReader(System.in));         

try
   {

     String str = br.readLine();
     System.out.println("\nInput-value = " + str);
     st = new StringTokenizer(str);
   }
  
   catch(IOException ioex)
   {
     ioex.printStackTrace();
   }

   while (st.hasMoreTokens())
   {
       iArr[i]= Integer.parseInt(st.nextToken());
       System.out.println("iArr[" + i + "]=" +iArr[i]);
       i++;
   }
  
  }

  public static void main(String[] args)
  {
   Grading cta=new Grading();
   cta.mCTA();
  }

}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA5] ActionEvent Example  (0) 2006/09/14
[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/48 관련글 쓰기

댓글을 달아 주세요

JAVA class 정의

Computer/IT/JAVA 2006/04/12 09:32 |
현실세계의 객체(OBJECT)를 프로그램으로 구현하기 위해 사용

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/45 관련글 쓰기

댓글을 달아 주세요

[CODE type="java"]
class Middle2 {
public static void main(String arg[]) throws java.io.IOException{

 char choice;
 String s1="";
 String s2="";
 
 System.out.print("\n첫번째 문자열 입력 : ");
 while ((choice = (char)System.in.read()) != '\n')
 {
  s1 = s1 + choice;
 }
 System.out.print("\n첫번째 정수값 : ");
 System.out.println(s1);

 System.out.print("\n두번째 문자열 입력 : ");
 while ((choice = (char)System.in.read()) != '\n')
 {
  s2 = s2 + choice;
 }
 System.out.print("\n두번째 정수값 : ");
 System.out.println(s2);
 
 }
}

/* 위에서 제공하는 부분 코드를 가지고 중앙값을 구하는 프로그램을 완성하시오 */
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/42 관련글 쓰기

댓글을 달아 주세요

[CODE type="java"]
class TwoArray
{
public static void main(String args[])
{
 int two_array[][] = new int[4][5];
 int i,j,k=0;
 
 for(i=0;i<4;i++)
 {
  for(j=0;j<5;j++)
  {
   two_array[i][j] = k;
   k++;
  }
 }
 
 for(i=0;i<4;i++)
 {
  for(j=0;j<5;j++)
   System.out.print(two_array[i][j]+ " " );
  System.out.println();
 }
}
}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/41 관련글 쓰기

댓글을 달아 주세요

[CODE type="java"]
import javax.swing.JOptionPane;

public class Addition
{
public static void main(String args[])
{
String firstNumber, secondNumber;
int number1, number2, sum;

firstNumber = JOptionPane.showInputDialog("Inter First Integer");

secondNumber = JOptionPane.showInputDialog("Enter Second Integer");

number1 = Integer.parseInt(firstNumber);
number2 = Integer.parseInt(secondNumber);

sum = number1 + number2;

JOptionPane.showMessageDialog(null, "The sum is " + sum, "Result", JOptionPane.PLAIN_MESSAGE);

System.exit(0);
}
}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
Posted by 싸구려코드
TAG Java, JOption

Trackback Address :: http://sarangsai.com/trackback/40 관련글 쓰기

댓글을 달아 주세요

[CODE type="java"]
class A { }
class B extends A { }
class C extends B { }

public class instanceofTest
{
public static void main(String args[])
{
 B ob = new B();
 if (ob instanceof B) System.out.println("B의 객체");
 if (ob instanceof C) System.out.println("C의 객체");
 if (ob instanceof A) System.out.println("A의 객체");
 
 A oa = new A();
 if (oa instanceof A) System.out.println("A의 객체");
 if (oa instanceof B) System.out.println("B의 객체");
 if (oa instanceof C) System.out.println("C의 객체");
 
}

}

[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/39 관련글 쓰기

댓글을 달아 주세요

예약어 super

Computer/IT/JAVA 2006/04/01 02:28 |

[CODE type="java"]
class C1
{
protected int a = 50;
private int b = 100;
static String x = "파이팅 자바";
void write()
{
System.out.println(x);
System.out.println(a);
System.out.println(b);
}
}


class C2 extends C1
{
String b = "어려운 자바";
String x = "쉬운 자바";
void write()
{
System.out.println(x);
System.out.println(a);
System.out.println(b);
super.write();
}
}


public class SuperTest2
{
public static void main(String args[])
{
C2 o = new C2();
o.write();
}
}

[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/38 관련글 쓰기

댓글을 달아 주세요

[CODE type="java"]
class C1
{
int a=100;
static String b = "파이팅 자바";
}

class C2 extends C1
{
String b;
String x = "쉬운자바";
}

class Inheritance
{
public static void main(String args[])
{
C2 o = new C2();

System.out.println(o.x);
System.out.println(o.b);
System.out.println(o.a);
System.out.println(C1.b);
}
}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
JAVA 기본 Data타입  (0) 2006/04/01
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/37 관련글 쓰기

댓글을 달아 주세요

오버로딩과 오버라이딩은 서로 혼동하기 쉽지만 사실 그 차이는 명백하다. 오버로딩은 기존에 없는 새로운 메서드를 추가하는 것이고, 오버라이딩은 조상으로부터 상속받은 메서드의 내용을 변경하는 것이다.


오버로딩(Overloading) - 기존에 없는 새로운 메서드를 정의하는 것(new)
오버라이딩(Overriding) - 상속받은 메서드의 내용을 변경하는 것(change, modify)


아래의 코드를 보고 오버로딩과 오버라이딩을 구별할 수 있어야 한다.


class Parent {
    void parentMethod() {}
}

class Child extends Parent {
    void parentMethod() {} // 오버라이딩
    void parentMethod(int i) {} // 오버로딩

    void childMethod() {}
    void childMethod(int i) {} // 오버로딩
    void childMethod() {}       // 에러!!! 중복정의 되었음.(already defined in Child)
}

'Computer/IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
JAVA 기본 Data타입  (0) 2006/04/01
Jad - the fast JAva Decompiler  (0) 2006/03/17
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/36 관련글 쓰기

댓글을 달아 주세요

[CODE type="c"]
class unary
{
public static void main(String args[])
{
int ii = 0;

System.out.println(ii++ + ii + ii--);
System.out.println(ii-- + ii);

int jj=0;
System.out.println(++jj + jj + --jj);
System.out.println(--jj + jj);


}
}
[/HTML][/CODE]
unary.java

download

'Computer/IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
JAVA 기본 Data타입  (0) 2006/04/01
Jad - the fast JAva Decompiler  (0) 2006/03/17
Posted by 싸구려코드

Trackback Address :: http://sarangsai.com/trackback/35 관련글 쓰기

댓글을 달아 주세요