[3466] in java-interest
protected is not?
daemon@ATHENA.MIT.EDU (Michael Daconta)
Mon Nov 13 21:17:46 1995
Date: Mon, 13 Nov 1995 16:38:15 -0700 (MST)
To: java-interest@java.sun.com
From: daconta@PrimeNet.Com (Michael Daconta)
Here is a simple chunk of code that does not
seem to work properly.
class junk {
protected String name;
junk(String inName)
{
name = new String(inName);
}
}
class Protect {
public static void main(String args[])
{
junk apiece = new junk("piece of junk");
System.out.println(apiece.name);
}
}
This code compiles and prints out the name of the
object. The problem is that the compiler should not have
let me do this. name is a protected variable. protected should
mean that inaccesible except to subclasses.
Any ideas or is this a bug?
I am using the beta for Win95.
- Mike Daconta
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com