I can declare the following package with modifiers but it doesn't seem to have any effect on anything:
private public protected static final package com.stackoverflow.mangodrunk
// ...
class Whatever {
// ...
}
So my question is, does adding a modifier before a package decleration do anything and why would it be allowed by the compiler?
Update: Seems to be an issue with the compiler bundled with Eclipse, as others have mentioned this is a compiler error using Sun's JDK.
They're not. Which compiler are you using?
$ javac com/stackoverflow/mangodrunk/Whatever.java
com/stackoverflow/mangodrunk/Whatever.java:1: class, interface, or enum expected
private public protected static final package com.stackoverflow.mangodrunk;
^
1 error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With