Question: Need a fix, and explain code. Why can't b.size access Small? If size = 1 is public shouldn't it be able to be accesssed from
Need a fix, and explain code. Why can't b.size access Small? If size = 1 is public shouldn't it be able to be accesssed from outside the class?
public class Big { private Small s = new Small(); public class Small { } public int size = 1; public static void main(String[] args) { Big b = new Big(); b.size; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
