Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Egidius Bakker   on May 25 In Java Category.

  
Question Answered By: Anna Hill   on May 25

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.

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on question on exception Or get search suggestion and latest updates.


Tagged: