The code fragment below is provided:
1. class Test{
2. public static void main(
String [] args){
3. aMethod();
4. }
5.
6. static void aMethod(){
7. try{
8. System.out.println("abcd");
9. return;
10. } finally {
11. System.out.println("1234");
12. }
13. }
14. }
This compiles.
My queries are
1) Why does it not complain about a return on line 9 when the method is null? (Is this to do with the fact the compiler looks to see what is returned - in this case nothing - and so the presence of null works like a break?)
2) Why doesn't it complain about a try without a catch?
What are the rules about including keywords in the code without actually using them?