Error : Move 'classname.java' to the default package.

During development of android application using eclipse you may get this error. 
Cause of this error is the class which you have declared with "classname" is not included in any of the package. 


Resolution: 
In order to resolve this error the newly declared class should be included in your application specific package or under default package. Default package is your application default package. 
Just add a line "package packagename;" at the top of your "calssname.java" file, will resolve the error.


Click on the error icon shown in the eclipse editor, it will show you two options either to move class in your application specific package or to move in default package.


A Java package is a mechanism for organizing Java classes into namespaces. Packages are typically used to organize classes belonging to the same category or providing similar functionality. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time.

No comments:

Post a Comment

Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...