hi there, i hopr u r doing fine,had to ask something,given below: case 1 :private class Ss{ case 2 :protected class Ss{ case 3 :public class Ss{ my question is In case 1 error is genereted why In case 2 erroe is genereted why in case 3 there is no error why please tell me that wat is the basic difference b/w them n why in two cases error is genereted n in last case there is no error.i hope that u ppl will help me asap. take care with regards kumar abhay [This message has been edited by Cindy Glass (edited November 26, 2001).]
kumar abhay
Ranch Hand
Joined: Oct 02, 2001
Posts: 53
posted
0
note:question was written wrong by mistake so it is the same question with nothing missing. hi there, i hopr u r doing fine,had to ask something,given below: case 1 private class Ss{ case 2 protected class Ss{ case 3 public class Ss{ my question is In case 1 error is genereted why In case 2 erroe is genereted why in case 3 there is no error why please tell me that wat is the basic difference b/w them n why in two cases error is genereted n in last case there is no error.i hope that u ppl will help me asap. take care with regards kumar abhay
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
10
posted
0
In Java, a top level class may only be public or default (no access modifier). You may not declare a class private or protected unless it is an inner class.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
kumar abhay
Ranch Hand
Joined: Oct 02, 2001
Posts: 53
posted
0
hi there, could u make it more clear plz. take care with regards kumar abhay
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
10
posted
0
<pre> public class myClass{} // OK class myClass{} // OK protected class myClass{} // not allowed in Java private class myClass{} // not allowed in Java
If you want to know why they are not allowed, you will have to ask James Gosling, the creator of the Java language.
class Outer { private class InnerOne{} // OK protected class InnerTwo{} // OK class InnerThree{} // OK public class InnerFour{} // OK } Inner classes are different. </pre>
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.