Questions about java access controller

Asked 2 years ago, Updated 2 years ago, 21 views

I want to use the account class in the AccountTest.java file How do I fix it?

Please tell me how to change classAccount {} to public classAccount {}. Thank you.

java

2022-09-21 11:37

1 Answers

Account and AccountTest are in different packages, but they are default without the access control indicator of the account class, so if you do not attach public, classes in different packages cannot use Account.

1) Attach public to the account, or 2) Put Account and AccountTest in one package


2022-09-21 11:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.