• 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

Sybex Java OCA 8 Study Guide Typo Chapter 4 page 198

 
Ranch Hand
Posts: 215
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sybex Java OCA 8 Study Guide Typo Chapter 4 page 198

In the Rabbit class, Java sees no constructor was coded and creates one. This default constructor is equivalent to typing this:
public Rabbit() {}

Typo: The default constructor has the default access implied by no access modifier, NOT PUBLIC.

by alinvlad05
 
Vlad Alin
Ranch Hand
Posts: 215
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also on page 241

For example, the following three class and constructor definitions are equivalent, because the compiler will automatically convert them all to the last example:
public class Donkey {
}

public class Donkey {
 public Donkey() {
 }
}

public class Donkey {
 public Donkey() {
   super();
   }
}

The constructors should be without public.
 
author & internet detective
Posts: 41855
904
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The book is correct. In a public class, you get a public constructor by default. This code compiles

 
Vlad Alin
Ranch Hand
Posts: 215
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
reply
    Bookmark Topic Watch Topic
  • New Topic