Java Programming
Accenture Technical PrimermediumJava Programming03 Class And Objects, Date Api

Accenture Java Programming Practice Question

Given the class Book and Library in two different packages : 1. package model; 2. public class Book { 3. private static void countBook { } 4. } 1. package util; 2. public class Library { 3. public static void main(String[] args) { 4. // insert code here 5. } 6. } What is required at line 4 in class Library to use the countBook method of Book class?

Answer options

A
Not accessible – countBook is private
B
Book.countBook()
C
model.Book.countBook()
D
import model.Book; Book.countBook()

Correct answer: Not accessible – countBook is private

Explanation

Quick AnswerThe correct answer is Not accessible – countBook is private because it directly addresses the core logic of Java Programming.

The countBook method is private; it cannot be accessed from the Library class in another package.

Related Accenture Java Programming questions

Practice more Accenture Java Programming questions

PrimerPrep has 1400+ practice questions, 2026 simulations and coding hands-on — all free.

Watch Walkthroughs!