Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Sybex - How many classes in a java file?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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."?
 
Marshal
Posts: 67430
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of what book?
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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: 40035
809
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume that on the pages that follow that sentence that there is only one class in a file.
 
    Bookmark Topic Watch Topic
  • New Topic