1.) The answer for the first question is that it depends on whether or
not the exception which is thrown is a checked or unchecked exception
and whether or not it inherits from the class which is being caught. If
it is an unchecked exception or it does inherit from the caught
exception's class then it will compile fine. If it does not then you
will not be able to compile your program.
2.) NullPointerException means that the reference you are using to the
object does not exist. In your example the reason you will get an NPE
is that the String s does not exist. You suggest that you can execute
something which says s.length = 0 even though s is not defined, but I
find this hard to believe. This is even harder to believe since String
has no length property.