Accessible packages

Report a typo

You have the following public classes:

  • A (default package)
  • org.demo.B
  • org.demo.mypackage.C

In the body of the class org.demo.B, you'd like to use other classes for writing fields:

package org.demo;

class B {

    B b = new B(); // (1)

    C c1 = new org.demo.mypackage.C();  // (2)

    org.demo.mypackage.C c2 = new org.demo.mypackage.C(); // (3)

    mypackage.C c3 = new mypackage.C(); // (4)

    A a = new A(); // (5)
}

Select all correct lines (see the number in the comments).

Select one or more options from the list
___

Create a free account to access the full topic