Same keyword for two purposes in java?
java
Solution
- `default` can be used both in a switch and as a default value in an annotation (as pointed out by Bozho)
- `final` means "can't be derived from / overridden" and "is read-only" which are two different - but related - meanings (as pointed out by Jon)
- `extends` can be used both to specify the supertype of a class and can be used in wildcards and type variables to put a constraint (related but not exactly the same) (`List<? extends Foo>`)
- `super` can be used to specify to something in a superclass of the current class, or in a wildcard to put a constraint (`List<? super Foo>`)
- `static` means both "part of the class, not an instance" (for methods, attributes or initializers) and as a `static import`
- `class` to declare a class (`class Foo {}`), or to refer to a class literal (`Foo.class`) (as answered by ILMTitan)
- (`for` can be used in a normal for loop and the "enhanced" for, but that's more like overloading (as Bozho puts it so nicely) than really having two meanings)
Problem
As we use "default" keyword as a access specifier, and it can be used in switch statements as well with complete different purpose, So i was curious that is there any other keywords in java which can be used in more then one purposes