• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Sybex OCA Java SE 8 Programmer I mistake page 252 ch5

 
Ranch Hand
Posts: 35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sybex OCA Java SE 8 Programmer I mistake page 252 ch5

A hidden method occurs when a child class defines a static method with the "same name and signature" as a static method defined in a parent class.

It should be same signature instead of "same name and signature" because signature already includes name.

by alinvlad05
 
Marshal
Posts: 74341
334
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a minor grammatical error, which I think I would ignore.
 
Vlad Alin
Ranch Hand
Posts: 35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also on page 260
This method is implemented with the same name and signature as the parent method in the Swan class.

It should be only same signature. It's a bit confusing.
 
Vlad Alin
Ranch Hand
Posts: 35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also on page 265

Implementing an abstract method in a subclass follows the same rules for overriding a method. "For example, the name and signature must be the same"

it should be only "signature".
 
Saloon Keeper
Posts: 1603
51
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with both of you.

The authors are exceedingly unlikely to update the Java 8 errata at this point, as the exam is likely to be retired soon.

I have badgered them (I hope they still love me) about similarly minute points, because taking the exam often feels like being cross-examined by an expert lawyer out to get you.

They will be doing a near total-rewrite of the Java 11 material for the Java 17-based exam preparatory material.

I think it is better to use terms as correctly (in line with the JLS, javadocs, etc.) as possible.

In Java, the signature includes the name and the parameter types, in other languages the return value is part of the signature, but not in Java.

It is moderately helpful to know these details, especially for exams but also beyond that.

They may make a note of this for the Java 17 book.
 
Vlad Alin
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also on page 278
If a class implements two interfaces that have default methods with the same name and signature, the compiler will throw an error.
 
reply
    Bookmark Topic Watch Topic
  • New Topic