Win a copy of Microservices in Action this week in the Web Services 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

OCAJP 8 study guide Chapter 1 Review questions 5  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I'm studying for OCAJP 8 certificate with Boyarsky, Selikoff study guide (EXAM 1Z0-808)
In the review questions of the first chapter, question 5 states:

Given the following classes, which of the following can indipendently replace INSERT IMPORTS HERE to make the code compile? (Choose all that apply)



  • A. import aquarium.*;
  • B. import aquarium.*.Jelly;
  • C. import aquarium.jellies.Jelly;
  • D. import aquarium.jellies.*;
  • E. import aquarium.jellies.Jelly.*;
  • F. None of these can make the code compile


  • I answered F because I supposed that all the code was in the same file.
    The solutions instead give as correct answers C and D because every class is supposed to be in its own file.
    Is this a general rule?
    When I find a question like this, how the code is supposed to be organised? Every class in its own file?

    Thank you!
     
    Davide Ripamonti
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Sorry.....
    I've just find out that I've created an already answered question.
    The answer is in
    https://coderanch.com/t/690455/certification/Confusion-understanding-OCA-IZO-Guide

     
    Marshal
    Posts: 61805
    193
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Welcome to the Ranch

    In this case, because there are several package delcarations, you have to assume the three classes are in different files. Also, all three classes are public so they must be in different files.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!