Thinking in Java Fourth Edition Bruce Eckel Chapter 5 Exercise 7

Exercise 7: Create the library according to the code fragments describing access and Widget. Create a Widget in a class that is not part of the access package.

package access;

public class Widget
{
    public Widget()
    {
        System.out.println("Widget()");
    }
}
import access.*;

public class MakeWidget
{  
    public static void main(String[] args)
    {
        Widget w = new Widget();
    }
}

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *