Skip to main content
added 5 characters in body
Source Link
tangens
  • 39.8k
  • 21
  • 128
  • 140

You can solve your problem by using different packages for your classes:

Put your class containing the main() method into package m. Then put class A in package a and make it public. Put class B in package ba, too and make it only package protected (skip the public key word).

Now you can access class A from your main(), but you can't access class B.

You can solve your problem by using different packages for your classes:

Put your class containing the main() method into package m. Then put class A in package a and make it public. Put class B in package b and make it only package protected (skip the public key word).

Now you can access class A from your main(), but you can't access class B.

You can solve your problem by using different packages for your classes:

Put your class containing the main() method into package m. Then put class A in package a and make it public. Put class B in package a, too and make it only package protected (skip the public key word).

Now you can access class A from your main(), but you can't access class B.

Source Link
tangens
  • 39.8k
  • 21
  • 128
  • 140

You can solve your problem by using different packages for your classes:

Put your class containing the main() method into package m. Then put class A in package a and make it public. Put class B in package b and make it only package protected (skip the public key word).

Now you can access class A from your main(), but you can't access class B.