• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ???
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

B is also invalid one because the return type Void must be before the method.
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic