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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

E practice exam questions for SCJP 5

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I purchased the e practice exam and don't understand bits of 2 questions in the first practice exam.

QUESTION 4 Exam 1

1. interface Animal {
2. void eat();
3. }
4.
5. // insert code here
6.
7. public class HouseCat extends Feline {
8. public void eat() { }
9. }


abstract class Feline implements Animal { }
-- FIRST OF ALL WHY IS THIS A LEGAL IMPLEMENTATION OF THE interface it doesn't implement the eat() method.

Question 8 Exam 1

Given:

1. class Banana {
2. int x = 1;
3. public static void main(String [] args) {
4. int x = 2;
5. Banana b = new Banana();
6. b.go();
7. }
8. { x += x; }
9. void go() {
10. ++x;
11. System.out.println(x);
12. }
13. }


Whis is the { x += x; } part of this code snippet legal???
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Closing this thread. It is a duplicate. Please refrain from duplicate postings.

Thanks

Mark
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic