Java 배우기145 Abstract Methods and Classes 추상적 메소드와 클래스 추상적 메소드와 클래스 Abstract Methods and Classes abstract class는 abstract로 선언된 클래스 입니다 - abstract 메소드들이 포함될 수도 포함하지 않을 수도 있습니다. abstract class들은 인스턴스화 될 수 없지만 subclass는 될 수 있습니다..abstract method는 아래와 같이 구현 없이(중괄호 없이 semicolon만 있는) 선언된 메소드 입니다:An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subcla.. 2016. 1. 5. Writing Final Classes and Methods Final 클래스 및 메소드 작성하기 Final 클래스 및 메소드 작성하기 Writing Final Classes and Methods You can declare some or all of a class's methods final. You use the final keyword in a method declaration to indicate that the method cannot be overridden by subclasses. The Object class does this—a number of its methods are final. You might wish to make a method final if it has an implementation that should not be changed and it is critical.. 2016. 1. 5. Object as a Superclass 수퍼클래스로서의 객체 수퍼클래스로서의 객체 Object as a Superclass The Object class, in the java.lang package, sits at the top of the class hierarchy tree. Every class is a descendant, direct or indirect, of the Object class. Every class you use or write inherits the instance methods of Object. You need not use any of these methods, but, if you choose to do so, you may need to override them with code that is specific to your c.. 2016. 1. 5. Using the Keyword super 키워드 super 사용하기 키워드 super 사용하기 Using the Keyword super Accessing Superclass Membersyour method가 그 superclass의 메소드 중 하나를 오버라이드 한다면, keyword super를 사용하여 오버라이드된 메소드를 invoke 할 수 있습니다. 또한 감춰진 필드(필드 감추기는 장려되지 않지만)를 참조하기 위하여 super을 사용할 수도 있습니다. Consider this class, Superclass: If your method overrides one of its superclass's methods, you can invoke the overridden method through the use of the keyword super. You can al.. 2016. 1. 5. Hiding Fields Hiding Fields 클래스 안에서, 수퍼클래스 안의 필드와 동일한 이름을 가진 필드는, 그들의 타입이 서로 다르다 할지라도 수퍼클래스의 필드를 숨깁니다. 서브클래스 안에서 수퍼클래스 안의 필드는 그 단순한 이름으로 참조될 수 없습니다. 대신, 필드는 수퍼를 통해 접근되어야 하는데, 이것은 다음 섹션에서 다룹니다. 일반적으로, 필드를 숨기는 것을 권장하지 않는 그 이유는 그것이 코드를 읽는 것을 어렵게 만들기 때문입니다.Within a class, a field that has the same name as a field in the superclass hides the superclass's field, even if their types are different. Within the subclas.. 2016. 1. 5. Polymorphism 다형성 다형성 Polymorphism 다형성(polymorphism)의 사전적 정의는 생물체나 종이 다양한 형태(forms) 또는 단계(stages)를 가질 수 있는 생물학 원리를 가리킵니다. 이 원리는 자바 언어와 같은 객체-지향 프로그래밍 및 언어에도 적용될 수 있습니다. 클래스의 서브클래스는 서브클래스 만의 독특한 행위를 정의하면서 여전히 부모 클래스의 동일한 기능의 일부를 공유할 수 있습니다.다형성은 클래스 Bicycle을 조금 수정하여 입증할 수 있습니다. 예를 들어, 메소드 printDescription을 현재 인스턴스에 저장된 모든 데이터를 표시하는 클래스에 추가할 수 있습니다.The dictionary definition of polymorphism refers to a principle in b.. 2016. 1. 5. 이전 1 ··· 7 8 9 10 11 12 13 ··· 25 다음