What is a default package ?

Answer Posted / vishwanath

A default package is the package, which a java class
belongs to, when theres no explicit package statement like

package foo;

----------
eg:

This class below is set to belong to the default package.
class Foo
{

}

-------------
Design considerations:

Its not a good design choice though to have it this way,
a java class belonging to the default package

Reason:
1) Bad modularizing
2) problems with access specifiers arise
etc...

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between exception and error in java?

579


What is difference between next () and nextline () in java?

644


What’s the difference between constructors and other methods?

625


how do I create a runnable with inheritance? : Java thread

621


Is string thread safe in java?

690






what is anonymous class in java?

647


Why is flag used in java?

639


Difference between error and exception

5226


How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

631


What is the purpose of final keyword and when to use it?

629


What one should take care of, while serializing the object?

558


What data type is string java?

632


Is arraylist zero based?

643


What does the “static” keyword mean?

677


What is the base class for error and exception?

643