본문 바로가기

Java 배우기145

Lesson: Annotations Lesson: Annotations 메타 데이터의 형태인 주석은 프로그램의 일부가 아닌 프로그램에 대한 데이터를 제공합니다. 주석들은 주석이 붙은 코드의 작동에 직접적인 영향을 미치지 않습니다.주석의 용도는 아래와 같이 많이 있습니다:Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate. Annotations have a number of uses, among them:컴파일러에 대한 정보 - 컴파일러는 오류를 찾거나 경고를 숨기기 위하여 주.. 2016. 1. 5.
Questions and Exercises: Enum Types Questions and Exercises: Enum TypesQuestionsTrue or false: an Enum type can be a subclass of java.lang.String.ExercisesRewrite the class Card from the exercise in Questions and Exercises: Classes so that it represents the rank and suit of a card with enum types.Rewrite the Deck class.Check your answers. 2016. 1. 5.
Enum Types 이넘 타입 이넘 타입 Enum Types enum type은 변수를 미리 정의된 1세트의 상수로 만들 수 있는 특수한 데이터 타입입니다. 변수는 미리 정의된 값 중 하나와 동일해야 합니다. 일반적인 예로 나침반의 방향 (NORTH, SOUTH, EAST, WEST의 값)과 요일 등이 있습니다.enum type은 상수이기 때문에, enum type의 필드의 이름은 대문자 입니다. An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must be equal to one of the values that have been predefined for it. Common e.. 2016. 1. 5.
Questions and Exercises: Nested Classes Questions and Exercises: Nested ClassesQuestionsThe program Problem.java doesn't compile. What do you need to do to make it compile? Why?Use the Java API documentation for the Box class (in the javax.swing package) to help you answer the following questions.What static nested class does Box define?What inner class does Box define?What is the superclass of Box's inner class?Which of Box's nested .. 2016. 1. 5.
When to Use Nested Classes, Local Classes, Anonymous Classes, and Lambda Expressions When to Use Nested Classes, Local Classes, Anonymous Classes, and Lambda Expressions As mentioned in the section Nested Classes, nested classes enable you to logically group classes that are only used in one place, increase the use of encapsulation, and create more readable and maintainable code. Local classes, anonymous classes, and lambda expressions also impart these advantages; however, they.. 2016. 1. 5.
Method References Method References You use lambda expressions to create anonymous methods. Sometimes, however, a lambda expression does nothing but call an existing method. In those cases, it's often clearer to refer to the existing method by name. Method references enable you to do this; they are compact, easy-to-read lambda expressions for methods that already have a name. Consider again the Person class discu.. 2016. 1. 5.