본문 바로가기

Java 배우기145

Evolving Interfaces Evolving Interfaces Consider an interface that you have developed called DoIt:public interface DoIt { void doSomething(int i, double x); int doSomethingElse(String s); } Suppose that, at a later time, you want to add a third method to DoIt, so that the interface now becomes:public interface DoIt { void doSomething(int i, double x); int doSomethingElse(String s); boolean didItWork(int i, double x.. 2016. 1. 5.
Using an Interface as a Type Using an Interface as a Type When you define a new interface, you are defining a new reference data type. You can use interface names anywhere you can use any other data type name. If you define a reference variable whose type is an interface, any object you assign to itmust be an instance of a class that implements the interface. As an example, here is a method for finding the largest object in.. 2016. 1. 5.
Implementing an Interface 인터페이스 구현하기 인터페이스 구현하기 Implementing an Interface interface를 구현하는 클래스를 선언하려면, 클래스 선언에 implements clause을 포함시킵니다. 클래스는 2개 이상의 인터페이스를 구현할 수 있기 때문에, 키워드 implements의 뒤에는 클래스가 구현한, 쉼표로 구분된 인터페이스 목록이 옵니다. 협약에 의하여, extends clause가 있다면 이 clause가 implements clause의 뒤에 옵니다.To declare a class that implements an interface, you include an implements clause in the class declaration. Your class can implement more than one .. 2016. 1. 5.
Defining an Interface 인터페이스 정의하기 인터페이스 정의 하기 Defining an Interface interface 선언은 modifiers, 키워드 interface, interface 이름, 쉼표로 분리된 부모 interface 목록(if any), interface 몸체로 구성됩니다. 예를 들면: An interface declaration consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces (if any), and the interface body. For example:public interface GroupedInterface extends Interface1, Interface2, In.. 2016. 1. 5.
Interfaces 인터페이스 인터페이스 Interfaces 소프트웨어 엔지니어링에는, 여러 프로그래머 그룹들이, 많은 경우에, 그들의 소프트웨어간 상호작용 방법을 서술하는 "계약" 에 동의하는 것이 중요합니다. 각 그룹은 다른 그룹의 코드 작성 방법을 모르고도 자신의 코드를 작성할 수 있어야 합니다. 일반적으로, interfaces가 그런 종류의 계약입니다.There are a number of situations in software engineering when it is important for disparate groups of programmers to agree to a "contract" that spells out how their software interacts. Each group should be able to.. 2016. 1. 5.
Lesson: Interfaces and Inheritance 단원: 인터페이스와 상속 단원: 인터페이스와 상속 Lesson: Interfaces and Inheritance 인터페이스 Interfaces앞 단원에서 인터페이스를 구현하는 예를 보았습니다. 여기서 인터페이스에 대하여 더 많이 읽을 수 있습니다 - 인터페이스가 무엇을 위한 것인지, 왜 인터페이스를 작성하기를 원하는지, 인터페이스를 작성하는 방법. You saw an example of implementing an interface in the previous lesson. You can read more about interfaces here—what they are for, why you might want to write one, and how to write one. 상속 Inheritance이 섹션은 다른 클래스로부터 .. 2016. 1. 5.