Hi,
Why would the Logger class be unreachable? The Java file can reside at any location irrespective of the pacakge. The class files will automatically go in the right directory if compiled with -d option. Since the question is not asking about the details of compilation, you can assume that right compilation switches are being used.
then we will have a package called util which has two public methods:
1. public class Logger
2. public class Logger
And I guess there can be only 1 public class in each package. right?
then we will have a package called util which has two public methods:
1. public class Logger
2. public class Logger
And I guess there can be only 1 public class in each package. right?
1. I not sure which two methods are you talking about. You've quoted the same class twice.
2. No, you can have as many public classes in a package as you want. You cannot have more than one public class in one file because a public class must always be in a file with the same name.
I meant we will have "public class TestClass" and "public class Logger".
But yes you are right. I was confused with files and packages. Thank you for the explanation.