Monday, 28 April 2014

Java Packages



-> Java pakages is a machanism for oraganizing java classes.

-> Pakaging name should start with reverse of our domain name.

Ex: The pakage for arunrajvdm.blogspot.com\drafts is

Pakage name = com.blogspot.arunrajvdm.drafts

-> Pakage statement should be on top of the java class file.

-> "import" statement is helpful to add pakage in class file.

-> There is no statement allowed in between the pakage statement and import statement while create the pakage.

Pakage com.mail;  \\
import com.blogspot.arunrajvdm.drafts; \\ here drafts is class. com,blogsport,arunrajvdm are pakages.

public class calc{
calc(){
System.out.println("hi");
}
}

Here not statement allowed in between import and pakage.


-> com.blogspot.arunrajvdm.*; - this statement says we can access all the available class inside the arunrajvdm pakage. But not sub pakage inside the arunrajvdm pakage.

No comments:

Post a Comment