• 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 - How many classes in a java file?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in page 5: "You can even put two classes in the same file. When you do so, at most one of the classes in the file is allowed to be public."
in page 6: "Each file can contain only one class."

Should page 6 rather say: "Each file can contain at least one public class."?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of what book?
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ioannis,
Welcome to CodeRanch!

I recognize that as being our book. Note that on the page 6, on the line before you quoted it says "To keep things simple for now, we'll follow a subset of the rules". Only one class is a subset at least one .

In other words, we are making a simpler world so you can focus on main methods() rather than how the complexities of classes.

Hope that helps.
 
Ioannis Gkinalas
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear and Jeanne, yes, the book is “OCA Oracle Certified Associate Java SE 8 Programmer” by J. Boyarsky and S. Sekikoff. Thank you Jeanne for you reply, however I don’t understand what you mean by "Only one class is a subset at least one".

I guess the question is what do you mean by "Each file can contain only one class" In page 6?

Many thanks and I wish you have a happy new year
 
Jeanne Boyarsky
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assume that on the pages that follow that sentence that there is only one class in a file.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic