码迷,mamicode.com
首页 > 其他好文 > 详细

Scope of a Declaration

时间:2018-03-09 16:14:20      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:starting   exp   star   main   date   asi   div   res   contain   

 

6.3. Scope of a Declaration

 

The scope of a declaration of a member m declared in or inherited by an interface type I (§9.1.4) is the entire body of I, including any nested type declarations.

interface I{
	class C{}
	static class D{}
}

The scope of a class‘s type parameter (§8.1.2) is the type parameter section of the class declaration, the type parameter section of any superclass or superinterface of the class declaration, and the class body.

The scope of an interface‘s type parameter (§9.1.2) is the type parameter section of the interface declaration, the type parameter section of any superinterface of the interface declaration, and the interface body.

interface IU<T>{ }
class CU<T>{}

public class main3<X extends Number> extends CU<X> implements IU<X> {

}

  

The scope of a constructor‘s type parameter (§8.8.4) is the entire declaration of the constructor, including the type parameter section, but excluding the constructor modifiers. 

public class main3{
	
	public <A,B extends A> main3(){
		
	}

}

  

 The scope of a local variable declaration in a block (§14.4) is the rest of the block in which the declaration appears, starting with its own initializer and including any further declarators to the right in the local variable declaration statement. 

int a = 1,b = a;

  

The scope of a local variable declared in the ForInit part of a basic for statement (§14.14.1) includes all of the following:

  • Its own initializer

  • Any further declarators to the right in the ForInit part of the for statement

  • The Expression and ForUpdate parts of the for statement

  • The contained Statement

ForInit、ForInitializer与ForUpdate

 

 

 

 

 

 

 

 

 

Scope of a Declaration

标签:starting   exp   star   main   date   asi   div   res   contain   

原文地址:https://www.cnblogs.com/extjs4/p/8534239.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!