CHAPTER 19: LALR(1) Java Grammar Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

19.8 Productions from Chapter 8: Class Declarations

19.8.1 Productions from Section 8.1: Class Declaration , 19.8.2 Productions from Section 8.3: Field Declarations , 19.8.3 Productions from Section 8.4: Method Declarations , 19.8.4 Production from Section 8.5: Static Initializers , 19.8.5 Productions from Section 8.6: Constructor Declarations


19.8.1 Productions from Section 8.1: Class Declaration


ClassDeclaration:

	Modifiersopt class Identifier Superopt Interfacesopt ClassBody

Super:

	extends ClassType

Interfaces:

	implements InterfaceTypeList

InterfaceTypeList:

	InterfaceType

	InterfaceTypeList , InterfaceType

ClassBody:

	{ ClassBodyDeclarationsopt }

ClassBodyDeclarations:

	ClassBodyDeclaration

	ClassBodyDeclarations ClassBodyDeclaration

ClassBodyDeclaration:

	ClassMemberDeclaration

	StaticInitializer

	ConstructorDeclaration

ClassMemberDeclaration:

	FieldDeclaration

	MethodDeclaration


19.8.2 Productions from Section 8.3: Field Declarations


FieldDeclaration:

	Modifiersopt Type VariableDeclarators ;

VariableDeclarators:

	VariableDeclarator

	VariableDeclarators , VariableDeclarator

VariableDeclarator:

	VariableDeclaratorId

	VariableDeclaratorId = VariableInitializer

VariableDeclaratorId:

	Identifier

	VariableDeclaratorId [ ]

VariableInitializer:

	Expression

	ArrayInitializer


19.8.3 Productions from Section 8.4: Method Declarations


MethodDeclaration:

	MethodHeader MethodBody

MethodHeader:

	Modifiersopt Type MethodDeclarator Throwsopt

	Modifiersopt void MethodDeclarator Throwsopt

MethodDeclarator:

	Identifier ( FormalParameterListopt )

	MethodDeclarator [ ]

FormalParameterList:

	FormalParameter

	FormalParameterList , FormalParameter

FormalParameter:

	Type VariableDeclaratorId

Throws:

	throws ClassTypeList

ClassTypeList:

	ClassType

	ClassTypeList , ClassType

MethodBody:

	Block 

	;


19.8.4 Production from Section 8.5: Static Initializers


StaticInitializer:

	static Block


19.8.5 Productions from Section 8.6: Constructor Declarations


ConstructorDeclaration:

	Modifiersopt ConstructorDeclarator Throwsopt ConstructorBody

ConstructorDeclarator:

	SimpleName ( FormalParameterListopt )

ConstructorBody:

	{ ExplicitConstructorInvocationopt BlockStatementsopt }

ExplicitConstructorInvocation:

	this ( ArgumentListopt ) ;

	super ( ArgumentListopt ) ;



Top© 1996 Sun Microsystems, Inc. All rights reserved.