0

Given, I know that <T> or <T, V extends Number> is the formal type parameter section. This is a declaration of the formal type parameter T ( type variables ). A type variable is an unqualified identifier used as a type in class, interface, static and non-static methods, and constructor bodies.

But I don't understand what means TypeParameter: {TypeParameterModifier} Identifier [TypeBound] in the documentation.

What does mean {}? Optional arguments?

What does mean []?

Where {} and [] in <T, V extends Number> ?

https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.4

TypeParameter:
  {TypeParameterModifier} Identifier [TypeBound]
TypeParameterModifier:
  Annotation
TypeBound:
  extends TypeVariable
  extends ClassOrInterfaceType {AdditionalBound}
AdditionalBound:
  & InterfaceType
3
  • 2
    The notation of the language grammar is defined in #2.4: {x} means zero or more and [x] means zero or one. Note 'T extends Number' is part of a single TypeParameter in 4.4, but the < > around the list and any commas in it are defined in 8.1.2. Commented Nov 29, 2023 at 10:04
  • PS: 'java docs' in general mean any docs (documentation) about Java, but the term (and tag) 'javadoc' means specifically documentation of classes, methods, etc in a library, often but not only the standard library, extracted from special comments in the library source; this does not include the language definition, because the language definition is not extracted from comments in the source code of a library. Commented Nov 29, 2023 at 10:07
  • @dave_thompson_085, thank you! If you add answer - I'll take it like answer. Commented Nov 29, 2023 at 14:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.