



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A course material for the java structures and practice (ina240) course offered by the department of internet media engineering at the korea national university of technology. It covers the history, features, and misconceptions of java, as well as the basic concepts of object-oriented programming and class design guidelines.
Typology: Lecture notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!
©copyright 2005 자료구조 및 실습( INA240)
3/14 3 /
자바 역사
1991 년: Sun Microsystems 사의 James Gosling과 Patrick Naughton이 개발한 고급 프로그래밍 언어 프로젝트 코드명: Green 원래는 지능형 TV와 같은 가정용 가전 제품에 사용될 언어로 개발됨 각 제조업체는 다른 CPU를 사용할 수 있으므로 특정 컴퓨터 구조에 독립성을 가지는 것이 가장 중요한 설계 목표였다. 기계어와 독립적인 중간중간 코드코드(intermediate code)를 생성하는 이동 가능 언어 개발 (write-once run anywhere) C++ 기반: 객체지향객체지향 언어언어 업계 반응: 냉대
자바 역사 – 계속
Gosling 등은 이 언어를 이용하여 1995 년도에 HotJava라고 하는 웹 브라우저를 개발함 이 브라우저는 기존 브라우저와 달리 자바로 작성된 애플릿애플릿 (applet)이란 프로그램을 웹에서 다운받아 실행할 수 있음 안전성과 이식성이 중요한 이슈 현재는 마이크로소프트 인터넷 익스플로러에서도 지원 1996 년: Sun Microsystems 사는 자바의 첫 버전 출시 실제 응용을 개발하기에는 기능이 미흡 1998 년: Java 2 출시 현재는 J2SE(Core/Desktop), J2EE(Enterprise), J2ME(Mobile) 세 종류의 버전을 제공
7/14 7 /
질문
C에서 int 타입과 자바의 int 타입의 차이점은? C에서 char 타입과 자바의 char 타입의 차이점은? 지역변수는 반드시 초기화해야 한다. (참 또는 거짓) 자바에는 열거형 타입이 있다. (참 또는 거짓) 변수 선언에서 finalfinal의 용도는? for(int i=0; i<10; i++) {}에서 i의 가시영역은? int n = 2.5; 문장은 오류인가?
질문
short-circuit evaluation이란? dangling-else 문제란? switch 문에서 “fall through” 행위란? new 연산자의 용도? 문자열 생성의 특이한 점은? int[ ] nlist = new int[10]; int[ ] alist = nlist; alist[3]=2; 그러면 nlist[3]? call-by-value와 call-by-reference의 차이점? garbage란, garbage collection이란?
9/14 9 /
OOP의 기본 개념
프로그램은 객체객체(object)로 구성됨 객체는 행위(behavior), 상태(state), 식별자(identity)를 가짐 캡슐화(encapsulation): 데이터와 행위를 하나로 결합 객체는 메시지를 받아 그것을 처리해준다. 내부 구현에 대해서는 don’t care 한 객체는 다른 객체의 내부 데이터를 절대 직접 조작하지 않음 클래스클래스(class) 같은 종류의 객체들의 모임 클래스는 이름을 가지며, 멤버변수(member/instance variable, field, attribute)와 메소드(method, member function)로 구성되어 있다. 클래스 간에 관계: use, has-a(aggregation), is-a(generalization) 인스턴스인스턴스(instance): 클래스의 한 객체
OOP의 기본 개념
상속상속(inheritance): is-a 관계 super/sub, base/derived, parent/child 세분화(specialization), 일반화(generalization) 재사용 용이하게 해준다. 관련 키워드: extends, super 자바는 다중 상속을 지원하지 않는다. 상속 계층구조, 상속 체인 다형성다형성(polymorphism) 연산은 객체에 따라 다른 행위를 한다. (late binding) overloading cf. overriding
13 13/14/
질문
package란? 어떤 특정 패키지를 사용하는 두 가지 방법? 자바 클래스 라이브러리 중 import 없이 사용할 수 있는 패키지는? import java.awt.*;을 사용하면 java.awt 패키지에 있는 모든 클래스가 프로그램이 실행될 때 포함된다. (참 또는 거짓)? instanceof 연산자의 기능은? cf. getClass() 메소드 abstract 메소드란, abstract 클래스란? 불변 객체(immutable object)란? Object 클래스란? Wrapper 클래스란? 자바는 다중 상속을 제공하나? interface란?, 그것의 용도는? 내부(inner) 클래스란?
클래스 설계 요령
멤버변수는 항상 private 멤버변수로 멤버변수를 항상 초기화한다. 클래스 내에 기본 타입을 많이 사용하지 마라. 예 예))
멤버변수와 메소드: camel case 한 클래스에게 너무 많은 책임을 주는 것은 피하라. 클래스와 메소드의 이름을 적절하게 부여하라.
private String street; private String city; private String state;
private Address addr;