본문 바로가기

Java 배우기145

Lesson: Packages 단원: 패키지 단원: 패키지 Lesson: Packages 이 단원에서는 클래스와 인터페이스를 패키지로 묶는 방법, 패키지 안에 있는 클래스들을 사용하는 방법, 그리고 컴파일러가 소스 파일을 찾을 수 있도록 파일 시스템을 배열하는 방법을 설명합니다. This lesson explains how to bundle classes and interfaces into packages, how to use classes that are in packages, and how to arrange your file system so that the compiler can find your source files.« DopZaClub » 2016. 1. 24.
Questions and Exercises: Generics Questions and Exercises: Generics특정 property (예, odd integers, prime numbers, palindromes)을 갖고 있는 collection내 엘리먼트의 수를 계산하기 위하여 제네릭 메소드를 작성하시오. Write a generic method to count the number of elements in a collection that have a specific property (for example, odd integers, prime numbers, palindromes). 다음 클래스는 컴파일됩니까? 안된다면 그 이유는? Will the following class compile? If not, why?public final class Alg.. 2016. 1. 24.
Restrictions on Generics Restrictions on GenericsTo use Java generics effectively, you must consider the following restrictions:Cannot Instantiate Generic Types with Primitive TypesCannot Create Instances of Type ParametersCannot Declare Static Fields Whose Types are Type ParametersCannot Use Casts or instanceof With Parameterized TypesCannot Create Arrays of Parameterized TypesCannot Create, Catch, or Throw Objects of .. 2016. 1. 24.
Non-Reifiable Types Non-Reifiable TypesThe section Type Erasure discusses the process where the compiler removes information related to type parameters and type arguments. Type erasure has consequences related to variable arguments (also known as varargs ) methods whose varargs formal parameter has a non-reifiable type. See the section Arbitrary Number of Arguments in Passing Information to a Method or a Constructo.. 2016. 1. 24.
Effects of Type Erasure and Bridge Methods Effects of Type Erasure and Bridge Methods Sometimes type erasure causes a situation that you may not have anticipated. The following example shows how this can occur. The example (described in Bridge Methods) shows how a compiler sometimes creates a synthetic method, called a bridge method, as part of the type erasure process.Given the following two classes:public class Node { public T data; pu.. 2016. 1. 24.
Erasure of Generic Methods 제네릭 메소드의 이레이저 제네릭 메소드의 이레이저 Erasure of Generic Methods 자바 컴파일러는 또한 제네릭 메소드 아규먼트에 있는 타입 패러미터를 지웁니다. 다름 제네릭 메소드를 검토하십시오: The Java compiler also erases type parameters in generic method arguments. Consider the following generic method:// Counts the number of occurrences of elem in anArray. // public static int count(T[] anArray, T elem) { int cnt = 0; for (T e : anArray) if (e.equals(elem)) ++cnt; return cnt; } .. 2016. 1. 24.