Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can somone explain why I can see C2 from C3 in P2? and why I can access o.x and invoke o.m1 from p2 in C3?Why

Can somone explain why I can see C2 from C3 in P2? and why I can access o.x and invoke o.m1 from p2 in C3?Why in class C3 and C2 there'r some variables and methods that are accessible and the ones that are not accessible.

image text in transcribedimage text in transcribed package p1; public class C1{ pub7ic int x; int y; private int z; public void ml(){ \} void m2() \{ \} private void m3() \{ \} \} package p2; public class C3 \{ void aMethod() \{ C1 0 = new C1(); can access o.x; cannot access o.y; cannot access o.z; can invoke o.m1(); cannot invoke o.m2(); cannot invoke o.m3(); \} \} \begin{tabular}{|l} package p1; \\ c1ass C1 \{ \\ \} \\ \hline \\ \hline \end{tabular} package p1; pub1ic c1ass C2 \{ can access C1 package p2; pub7ic c7ass C3 \{ cannot access C1; can access C2; \}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions