달력

03

« 2010/03 »

  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  
2009/10/07 18:49

groovy - db2 jdbc 연결 기본 예제 Computer/IT/JAVA2009/10/07 18:49



 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.컬럼명}"

    }
  }
}




심플
저작자 표시
TAG DB2, Groovy, JDBC
Posted by 싸구려코드
2009/08/20 15:16

Java jconsole 설정 Computer/IT/JAVA2009/08/20 15:16


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


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 싸구려코드
AMChart 를 PNG 파일로 저장하는 코드...
org.jfree.chart.ChartUtilities의 writeBufferedImageAsPNG 이용...






amchart의 setting 파일에 다음 내용 추가...
Posted by 싸구려코드
2008/05/19 16:34

HashMap -> Collection -> Iterator Computer/IT/JAVA2008/05/19 16:34

  HashMap hashmap = new HashMap();

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

Posted by 싸구려코드

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

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

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

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

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

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


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

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

JAVA JSpinner Number 사용법 Computer/IT/JAVA2008/01/02 19:37


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
TAG Java, JSpinner
Posted by 싸구려코드
2007/12/06 16:27

ECLIPSE - eclipse.ini 실행옵션 Computer/IT/JAVA2007/12/06 16:27

-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 싸구려코드
2007/11/23 11:04

Servlet to Applet (Echo) Example Computer/IT/JAVA2007/11/23 11:04

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 싸구려코드
2007/11/19 09:25

Eclipse - JAD Pluggin Computer/IT/JAVA2007/11/19 09:25

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


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 싸구려코드
2007/08/13 10:40

[SWT] 기본적인 Hello Window Computer/IT/JAVA2007/08/13 10:40


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 싸구려코드
 
  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 싸구려코드
 
  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. }

TAG file i/o, Java
Posted by 싸구려코드
2006/09/18 19:28

[JAVA] APPLET - ButtonEvent Computer/IT/JAVA2006/09/18 19:28

버튼을 생성하여 컨테이너 애플릿에 붙인뒤 이벤트 처리
  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 싸구려코드
2006/09/18 19:18

[JAVA] APPLET - Label 사용예제 Computer/IT/JAVA2006/09/18 19:18

  레이블을 생성하여 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. }

TAG AWT, Java, Label
Posted by 싸구려코드
방향키를 이용해 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 싸구려코드
2006/09/14 14:10

[JAVA5] ActionEvent Example Computer/IT/JAVA2006/09/14 14:10

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 싸구려코드
2006/09/14 12:12

[JAVA] InetAddress Computer/IT/JAVA2006/09/14 12:12

  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 싸구려코드
2006/04/16 17:09

콘솔입력받아 배열에 넣기 Computer/IT/JAVA2006/04/16 17:09

[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 싸구려코드
2006/04/12 09:32

JAVA class 정의 Computer/IT/JAVA2006/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 싸구려코드

[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 싸구려코드
2006/04/05 10:18

2차원 배열 생성, 값 배정 Computer/IT/JAVA2006/04/05 10:18

[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 싸구려코드
2006/04/04 20:16

swing 자바 Addtion Computer/IT/JAVA2006/04/04 20:16

[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
TAG Java, JOption
Posted by 싸구려코드
2006/04/01 02:41

연산자 instanceof Computer/IT/JAVA2006/04/01 02:41

[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 싸구려코드
2006/04/01 02:28

예약어 super Computer/IT/JAVA2006/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 싸구려코드
2006/04/01 02:17

멤버 변수의 상속 Computer/IT/JAVA2006/04/01 02:17

[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 싸구려코드
오버로딩과 오버라이딩은 서로 혼동하기 쉽지만 사실 그 차이는 명백하다. 오버로딩은 기존에 없는 새로운 메서드를 추가하는 것이고, 오버라이딩은 조상으로부터 상속받은 메서드의 내용을 변경하는 것이다.


오버로딩(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 싸구려코드
2006/04/01 01:59

-- ++ 연산자 테스트 Computer/IT/JAVA2006/04/01 01:59

[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 싸구려코드
2006/04/01 01:45

JAVA 기본 Data타입 Computer/IT/JAVA2006/04/01 01:45


[CODE type="c"]
public class DataTypeTest
{
public static void main(String args[])
{
System.out.println("1. 16진수값 : " + 0x11);
System.out.println("2. 8진수값 : " + 011);
System.out.println("3. 십진수값 : " + 111);
System.out.println("4. 2.0f / 3.0f = " + 2.0f / 3.0f);
System.out.println("5. 2.0 / 3.0 = " + 2.0 / 3.0);
System.out.println("6. 2/3 = " + 2/ 3);
System.out.println("7. 지수형 데이터 3.14159e-3 = " + 3.14159e-3);
System.out.println("8. 이진형 데이터 값 : " + true + (10 > 20));
System.out.println("9. 특수문자값 : \\ \"");
System.out.println("10. 유니코드값 : \u004a \u004f");
}
}

[/HTML][/CODE]


'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
TAG datatype, Java
Posted by 싸구려코드
2006/03/17 09:20

Jad - the fast JAva Decompiler Computer/IT/JAVA2006/03/17 09:20



자바 class -> java로 다시 디컴파일러 하는 툴...
http://www.kpdus.com/jad.html

'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 싸구려코드