This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes explain this one .... i didnot understand it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "explain this one .... i didnot understand it." Watch "explain this one .... i didnot understand it." New topic
Author

explain this one .... i didnot understand it.

Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
Which two declarations prevent the overriding of a method? (Choose Two)
A. Final void methoda() {}
B. Void final methoda() {}
C. Static void methoda() {}
D. Static final void methoda() {}
E. Final abstract void methoda() {}

Explain me please ???
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Karthik,
Write a sample code which includes all those options and see what compiler gives you.
and try to analyze it.


Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Rajat Gupta
Greenhorn

Joined: Sep 16, 2005
Posts: 7
FROM KARTIK ---

Which two declarations prevent the overriding of a method? (Choose Two)
A. Final void methoda() {}
B. Void final methoda() {}
C. Static void methoda() {}
D. Static final void methoda() {}
E. Final abstract void methoda() {}

My Answer: B & D
Explaination: A,E contain illegal final keyword with the capital "F". So, they are incorrect method declerations and there is no final in c. Hence B & D.

Cheers,
Rajat
Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
hi

B is also invalid one because the return type Void must be before the method.
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8764
    
    5
Hi Karthik,

I really like the answer that Jay gave you!

I appreciate your enthusiasm, but I'd request that when you ask questions you also indicate your "partial solution". In other words, what do you think about the question at the time you ask it? We've found that if you ask a question and someone else just answers it, not a lot of learning goes on. That's a great approach for a tech support center, but we're all here to learn these topics, not just get answers.

The other thing we've found is that by explaining more about what you know, your own learning will progress. A common tip for these forums is that the best way to learn these topics is to answer questions. It's amazing how the process of writing down an answer helps you clarify what you know, and show the areas in which you're still fuzzy.

Thanks, and keep those (well formed) questions coming!

Bert


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
yes brates

I understand your advice

i posted the question , i was my self some what not 100%confident

so i want to know whether ranchers answering the question is same what i thought. SO want to know whether i am understood with concepts )

any way i will ever after type answer of what i thought.....

Bert...........I am giving exam in 3days. SO i need final tips and preparation
Alejandro Montenegro
Greenhorn

Joined: Jul 05, 2004
Posts: 29
my answer would be A and D .. if you look at the options every one starts with a capial letter so there wouldnt be no right answer. I believe it is a typo, and should be:

A. final void methoda() {}
B. void final methoda() {}
C. static void methoda() {}
D. static final void methoda() {}
E. final abstract void methoda() {}

Remeber NO reserved keywords has capital letter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: explain this one .... i didnot understand it.
 
Similar Threads
Static methods cannot be overriden query...
overriding question required
how to prevent overriding method?
Question on interface
the" fina"l and "static'