How can a class be accessed, If no access modifiers are
declared?

Answers were Sorted based on User's Feedback



How can a class be accessed, If no access modifiers are declared?..

Answer / banti

If a there is no access modifier specified to a class it
takes the access modifier as Default. This means the class
which has Default Access modifier can be accessed from
other classes defined in the same package.

Is This Answer Correct ?    2 Yes 0 No

How can a class be accessed, If no access modifiers are declared?..

Answer / ranganathkini

If a class is marked with no access modifiers then it is
given "package" access by default which means it can be
instantiated or subclasses by other classes in the same
package but it is inaccessible to classes outside the same
package.

Is This Answer Correct ?    0 Yes 0 No

How can a class be accessed, If no access modifiers are declared?..

Answer / ravikiran(aptech mumbai)

the default access will be resticted to the classes with in
the same package

Is This Answer Correct ?    0 Yes 0 No

How can a class be accessed, If no access modifiers are declared?..

Answer / babu

If a there is no access modifier specified to a class then it
takes the access modifier as Default modifier.Default Access modifier scope is package scope.so this class scope also package scope to access the classes which is having in the same package.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is nan inf?

0 Answers  


Explain how to convert any java object into byte array.

0 Answers  


Given: 11. public static void main(String[] args) { 12. Integer i = uew Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println(”three”); break; 15. default: System.out.println(”other”); break; 16. } 17. } ‘What is the result? 1 three 2 other 3 An exception is thrown at runtime. 4 Compilation fails because of an error on line 12.

9 Answers  


which one the better thread emplemented thread or extended ?

4 Answers   Fidelity,


Why can't we make jsp as a controller and action servlet in struts?

8 Answers   TCS, Wipro,


why not override thread to make a runnable? : Java thread

0 Answers  


I want to store more than 10 objects in a remote server? Which methodology will follow?

0 Answers  


How do you override a method in java?

0 Answers  


What is javac used for?

0 Answers  


Explain abstract class in java?

0 Answers  


What are File and RandomAccessFile classes?

2 Answers  


What is java autoboxing?

0 Answers  


Categories