• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

throw or throws ?

 
Jingxian Zhou
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


How will you declare mymethod so that it will throw a Exception? Select one?
A. In method declaration give throw Exception and inside the method
give throws Exception
B. In method declaration give throws Exception and inside the method
give throw Exception
C. In method declaration give throw Exception and inside the method
give throw Exception
D. In method declaration give throws Exception and inside the method give throws Exception
Ans:A

I don't really get it..why the answers is A not B?
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please QuoteYourSources. And welcome to the ranch !
 
Jingxian Zhou
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Please QuoteYourSources. And welcome to the ranch !


Sources are all here.

I think B is right answer,so...
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Hibernate Linux Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jingxian Zhou wrote:Sources are all here

Give name of source
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jingxian Zhou wrote:Sources are all here.

Jingxian you are supposed to tell us the name of the mock exam or book from where you took this question. Only then would we be able to help you with the question...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic