This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Karu Raj
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik,
Write a sample code which includes all those options and see what compiler gives you.
and try to analyze it.
 
Rajat Gupta
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

B is also invalid one because the return type Void must be before the method.
 
Bert Bates
author
Sheriff
Posts: 8905
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Karu Raj
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic