• 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

package problems

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given three files:






Which, inserted at // insert code here will allow all three files to compile? (Choose all
that apply.)
A. void go() { System.out.println("a.go"); }
B. public void go() { System.out.println("a.go"); }
C. private void go() { System.out.println("a.go"); }
D. protected void go() { System.out.println("a.go"); }
E. None of these options will allow the code to compile.

My understanding about the following is :
1. if class TestXcom would have extended from class B, I could use both B and D as Answer.. correct me if Wrong..
2. if I had to call the method go() from Class B, could I do so by adding options B or D?
 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please QuoteYourSources
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Devaka Cooray wrote:Please QuoteYourSources



source : Katherine sierra & bert bates book.. chapter 10 about packages.. it is one of self test questions
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please do a search for "xcom" (use the "Search" link in the top right of the page) - this question has been discussed many times before here on JavaRanch.
 
reply
    Bookmark Topic Watch Topic
  • New Topic