GIAC
GSSP-JAVA · Question #161
Mark works as a Programmer for InfoNet Inc. He writes the following programs. 1. package book; 2. public class read 3. { 4. (access modifier) int r1=10; 5. } 1. package book1; 2. import book.read…
The correct answer is C. protected. See the full explanation below for the reasoning.
Question
Mark works as a Programmer for InfoNet Inc. He writes the following programs. 1. package book; 2. public class read 3. { 4. (access modifier) int r1=10; 5. } 1. package book1; 2. import book.read; 3. class Doread extends read 4. { 5. public void test() 6. { 7. System.out.println("The value of r1 is." +r1); 8. } 9. } Which of the following access modifiers will be put in the place of the word, (access modifier), to compile the program successfully?
Options
- Adefault
- Bpublic
- Cprotected
- Dprivate
- Evolatile
How the community answered
(46 responses)- A2% (1)
- B9% (4)
- C74% (34)
- D2% (1)
- E13% (6)
Community Discussion
No community discussion yet for this question.