Java
Programming and Technical
Programming
Definition
can we declare a subclass as a public
whose upper class has already been declared as private?
Read Solution (Total 10)
-
- Firstly We can never declare a class as private untill that class is a Nested class.
Secondly Child class of [Nested private class] can be declared as public
- 10 years agoHelpfull: Yes(8) No(1)
- Classes always marked as public or default access specifiers,,otherwise the class can be marked with abstract,final...u cant mark class as private
- 10 years agoHelpfull: Yes(3) No(0)
- private class SuperDemo {
public class SubDemo {
public static void main(String ar[])
{
}
}
}
//compilt time error - 10 years agoHelpfull: Yes(2) No(2)
- We can not declare use private with a class, only public , abstract , final and default is used , if we use private then class would not compile , let u check in eclipse IDE , there is no option for private.
- 10 years agoHelpfull: Yes(2) No(0)
- no we cannot declare the subclass as a public because already super class is declared sa a private it means scope of super class is witin that class only.
- 10 years agoHelpfull: Yes(1) No(0)
- no, bcz we can not declare class as private we can use public and default for class declaration.
- 9 years agoHelpfull: Yes(1) No(0)
- Yes we can ...because if we cant then we can never use the resources of those classes.
- 11 years agoHelpfull: Yes(0) No(4)
- yes
because we can create a public class declaration after the private class
- 10 years agoHelpfull: Yes(0) No(1)
- no we can use either punlic or default
- 8 years agoHelpfull: Yes(0) No(0)
- when we declare a class as private and it cannot give features to another class .so we cannot declare its subclass as public..even if we declare a subclass as public it wont work because already its upperclass declared as private
- 8 years agoHelpfull: Yes(0) No(0)
Java Other Question