wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes throw or throws ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "throw or throws ?" Watch "throw or throws ?" New topic
Author

throw or throws ?

Jingxian Zhou
Greenhorn

Joined: Jun 22, 2010
Posts: 28


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?


SCJP6(310-065) with 96%, SCWCD (310-083) with 89%, SCBCD 5 (310-091) with 98%
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Please QuoteYourSources. And welcome to the ranch !


[My Blog]
All roads lead to JavaRanch
Jingxian Zhou
Greenhorn

Joined: Jun 22, 2010
Posts: 28
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

Joined: Aug 31, 2007
Posts: 787

Jingxian Zhou wrote:Sources are all here

Give name of source


SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: throw or throws ?
 
Similar Threads
difference B/w Throw and throws
JavaCaps mock 1 Q:9
Difference between throw and throws
Checked and Unchecked Exceptions
Throwing Exceptions