Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Must be a JDK version problem
Posted by Kishori Sharan on December 08, 2000 at 8:59 AM
Hi Chris There is no problem with your inner class and its constructor declaring them protected. If it is giving error then it must be a version problem. I am running java v1.3 . Please check your JDK version and I am sure it is prior to v1.3. I tested the following code C.java and it works fine on my machine. Thanx Kishori ///////////////// C.java class A { protected class B { protected String s ; protected boolean b ; protected B (String s, boolean b) { this.s = s ; this.b = b ; } public void msg ( ) { System.out.println ( "String = " + s + " Boolean = " + b ) ; } } } public class C extends A { public void f( String s, boolean b ) { B b1 = new B( s, b ); b1.msg ( ) ; } public static void main ( String[] args ) { new C ( ).f ( "hello", true ) ; } }
Replies:
|