This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I went through a test by Jaworski, It says that If a package statement is included in a source file then it must appear as first non blank line. I think this is not correct Please advice Thanks in advance Kareem
There is no such requirements stated in the JLS. The only requirement is that the package statement (0 or 1 per compilation unit) must precede all import statements (zero or more) which in turn must precede the following class and/or interface declarations (zero or more). It is perfectly allowed to have blank lines and/or comments before the package statement. There are numerous examples out there proving this point (just start with Sun's classes). One more point, an empty file will compile and is a valid Java source file.
Thanks i was sure of the answer but you know i am scheduled to take the exam two weeks from now and presently taking all the tests available on net. So that is why i am posting mistakes or things which i think are mistakes. so that i will not make that mistake ever again. Kindly bear with me because my aim is to get 100%(pretty ambitious but achievable with your help) of course the last exam i would take before the final exam is Valentin's mock test. Thanks Kareem