토요일, 4월 20
Shadow

미분류

#009 자바응용프로그램 분석

미분류
4.1 자바응용프로그램 분석 1. 주석 /* */ // /**주석 */  ---->Javadoc에서 생성된 Html 파일에서 사용 class의 main문을 java확장자의 이름으로 지정한다. int c;--->클래스 public int add(int a, int b)-->괄호안은 메소드 main() 메소드 public static void main(String arg[]){ '''' } *일반적으로 자바 응용프로그램은 amin() 메소드 내에 서 다른 클래스의 객체를 생성한 다음 그 객체에 메세지를 보내어 원하는 결과를 얻는다. args[]는 String클래스 배열로 받아드림 명령행 매개변수(command-line-argument): 프로그램 실행시 필요한 정보를 전달 x=Integer.parseInt(args[0]); y=integer.parseint(args[1]); -->args[]에 저장도니 데이터를 숫자로 사용하기위해 integer.parseint()메소드를 사용하여 변환 객체의 생성과 메시지 전달 Exam examobject = new Exam();//Exam()클래스를 생성하여 examobject로 만들어짐 sub=examobject.add(x,y); System.out.println("입력한 값의 합은" + sum + "입니다."); 클래스이름.객체이름.메소드이름(메소드의 매개변수); *println은 표준출력문 4.2 자바애플릿 프로그램 분석 애플릿 프로그램의 특징 -main()메소드가 없다. -네트...

#008 JAVA 객체지향/절차지향

미분류
3.1 객체지향과 절차지향 *객체지향의 배경 -소프트웨어 모듈의 재사용과 독립성을 강조 *객체 -효율적인 정보관리를 위해 의미를 부여하고 분류하는 개념적인 단위 *객체지향:객체들이 메세지를 통해 통신함으로써 원하는 결과를 얻는다. 각 객체는 데이터와 데이터를 처리할수 있는 메소드로 구성. 객체(데이터1---> 메소드1)--->메세지--->객체(메소드2--->데이터2) *절차지향: 알고리즘으로 구성 *객체의 구성 데이터 : 속성의 값 메소드 : 데이터를 변경하거나 조작할수 있음 아버지객체 :데이터(자동차, 돈,술, 몽둥이, 신문, 담배) 메소드 (운전을한다, 술을마신다. 담배를 피운다 몽둥이로 때린다 신문을 읽는다 ) 아들객체 : 데이터(장난감, 과자, 동화책 게임기) 메소드 (과자를 먹는다. 동화책을 읽는다.) ----------------------------- 클래스(CLASS) 객체는 항상 클래스로 부터 생성. 학생1(객체이름)=new(객체생성 명령어) 학생(클래스이름)<이기쁨,남자,컴퓨터공확과>(매개변수데이터) instance : 클래스로 부터 생성된 객체 *정보처리의 주체(객체) 객체지향프로그래밍의 시작은 클래스의 생성이다. -------------------------------- 상속(inheritance) 클래스는 계층구조를 구성 상위계층의 모든 요소 상속 추가적으로 필요로 되는 새로운 자료구조와 매소드를 추가 하여 하위계층의 클래스 생성 -소프트웨어의 재사용을 위해 상속 필요 일반화 -...

#007 JAVA Env

미분류
int형은 항상 32bit JIT컴파일제공 2.1 자바 개발 환경 JDK설치 - 자바번역기 : Javac 자바해석기 : java 애플릿 프로그램실행기 : appletviewer 2.2자바애플릿프로그램 JDK는 GUI 형태의 개발환경을 제공하지 않는다. import java.applet.*; import java.awt.*; public class Example2 extends Applet{ public void paint(Graphics g){ g.drawString("안녕하세요",100,60); } }

#006 java intro

미분류
1. 자바의 특징 1.자바는 단순하며, 객체지향언어이다. 2.자바는 신뢰할 수 있는 언어이며, 보안을 위한 안전한 장치가 있다. 3.자바는 구조 중립적이며, 뛰어난 이식성있다. 4.자바는 높은 수행능력을 갖고 있다. 5.자바는 멀티 쓰레드를 지원하는 동적인 언어이다. 2.자바프로그램 설치

#001 java Script 강좌

미분류
<html> <head> <title>변수를 따옴표 속에 넣으면 어떻게 될까.</title> <script type="text/javascript"> <!-- var str01 = "처음으로 작성한 script" document.write("str01") // --> </script> </head> <body> </body> </html> <body> <script type="text/javascript"> <!-- txt1 = "Web designer" txt2 = " must be creative." txt3 = txt1 + txt2 document.write(txt3) // --> </script> </body> <body> <script type="text/javascript"> <!-- txt1 = "Web designer" txt2 = " must be creative." txt3 = "<b>" + txt1 + txt2 + "</b>" document.write(txt3) // --> </script> </body> <body><p onclick="javascript:alert('경고창을 띄웁니다.')">클릭해 주세요.</p></body> ...

#005 What is Class?

미분류
dogs have state (name, color, breed, hungry) behavior(barking, fetching, wagging tail) computer have variable(state). it's item of data named by an identifier object implements its behavior with methods. method is a function event is a common object used particular object is called an instance. object may expose some of its variables or hide some of its methods Message? When object A wants object B to perform one of B's methods, object A sends a message to object B The next figure shows the three parts of a message: The object to which the message is addressed (YourBicycle) -call by referense The name of the method to perform (changeGears) Any parameters needed by the method (lowerGear) Messages provide two important benefits: An object's behavior is expressed...

#004 Class & Object

미분류
Member variables in a class—these are called fields. Variables in a method or block of code—these are called local variables. Variables in method declarations—these are called parameters. public int cadence; public int gear; public int speed; The fields of Bicycle are named cadence, gear, and speed and are all of data type integer (int). The public keyword identifies these fields as public members, accessible by any object that can access the class. public modifier—the field is accessible from all classes. private modifier—the field is accessible only within its own class. public class Bicycle { private int cadence; private int gear; private int speed; public Bicycle(int startCadence, int startSpeed, int startGear) { gear = startGear; cadence = startCadence; speed =...

#003 Object Detail

미분류
Point originOne = new Point(23, 94); Rectangle rectOne = new Rectangle(originOne, 100, 200); Rectangle rectTwo = new Rectangle(50, 100); first line creates an object from the Point class and the second and third lines each create an object from the Rectangle class. Declaration: The code set in bold are all variable declarations that associate a variable name with an object type. Instantiation: The new keyword is a Java operator that creates the object. As discussed below, this is also known as instantiating a class. Initialization: The new operator is followed by a call to a constructor. For example, Point(23, 94) is a call to Point's only constructor. The constructor initializes the new object. The declared type matches the class of the object: MyClass myObject = new MyClass(); ...

#002 정렬 두가지 방법 순차정렬(앞뒤)

미분류
/* * Main.java * * Created on 2006년 7월 25일 (화), 오전 11:12 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package array; /** * * @author Administrator */ public class Main { /** Creates a new instance of Main */ public Main() { } /** * @param args the command line arguments */ public static void main(String args[]) { int[] ArrayData ={10,20,50,45,4,22,31,41}; int[] ArrayData1={10,20,50,45,4,22,31,41}; //postfix for(int i=0;i<ArrayData.length;i++){ for(int j=i;j<ArrayData.length;j++){ if(ArrayData[j]<ArrayData[i]){ int temp=ArrayData[j]; ArrayData[j]=ArrayData[i...

#001 OPERATOR

미분류
<<  op1 << op2  Shifts bits of op1 left by distance op2; fills with 0 bits on the right side >>  op1 >> op2  Shifts bits of op1 right by distance op2; fills with highest (sign) bit on the left side >>>  op1 >>> op2  Shifts bits of op1 right by distance op2; fills with 0 bits on the left side &  op1 & op2  Bitwise AND if both operands are numbers; conditional AND if both operands are boolean |  op1 | op2  Bitwise OR if both operands are numbers; conditional OR if both operands are boolean ^  op1 ^ op2  Bitwise exclusive OR (XOR) ~  ~op  Bitwise complement AND 0 0 0 0 1 0 1 0 0 1 1 1 OR 0 0 0 0 1 1 1 0 1 1 1 1 XOR 0 0 0 0 1 1 1 0 1 1 1 0 static final int VISIBLE = 1; static final int DRAGGABLE = 2; static fin...