[3781] in java-interest

home help back first fref pref prev next nref lref last post

Protected Is Default?

daemon@ATHENA.MIT.EDU (David Geary)
Mon Nov 27 20:32:40 1995

Date: Mon, 27 Nov 1995 09:36:17 -0700
From: David.Geary@Central.Sun.COM (David Geary)
To: java-interest@java.Eng.Sun.COM

I've got a class that extends Container:

	package foo;

	import java.awt.Container;

	class A extends Container {
		B b = null;
	}

When I compile:

	trilby >> javac foo/A.java    
	foo/A.java:5: No constructor matching Container() found in class java.awt.	Container.
	class A extends Container {
      	^
	1 error

Of course there is a Container():

	// In Container.java:

	Container() {
	}

If I change Container's default constructor access modifier to protected:

	// In Container.java:

	protected Container() {
	}

Then all is well:

trilby >> javac foo/A.java
trilby >>

  What's the deal?  Is protected not the default access modifier? I'm using 
the BETA release on Solaris 2.4, BTW.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 David Geary                                  "I'm a bad man; I do what I can"
 geary@rmtc.Central.Sun.COM      
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post