- Java/NestingClass
//Listing 4. NestedTopLevelClassDemo.java
// NestedTopLevelClassDemo.java
class NestedTopLevelClassDemo
When run, NestedTopLevelClassDemo produces the following output:
NestedTopLevelClassDemo의 메인 함수에서 NestedTopLevelClass 변수 ntlc를 만들었다. 변수를 선언하기 위한 문법(syntax)는 Listing3의 Employee와 같다. 일반적으로, 중첩된 클래스 타입의 변수가 필요할 때, 최상위 중첩 클래스부터 점 구분자를 이용해서 최하위 중첩 클래스까지를 표현하면 된다. 예를 들면 다음과 같다. Nest1,Nest2,Nest3 3개의 중첩 클래스가 있다고 가정하고, Nest3의 인스턴스를 생성하고 싶을 때에는 다음과 같은 방법을 이용하면 된다. Nest1.Nest2.Nest3 nestedClass = Nest1.Nest2.Nest3()
Found 1 matching page out of 7540 total pages
You can also click here to search title.