You may import either an individual class from a package or the entire package. : import « Java Source And Data Type « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Java Source And Data Type » import 
1.4.1.You may import either an individual class from a package or the entire package.
To import an individual class


import java.util.List;
public class MainClass{
   private int iValue;
}



To import an entire package, simply add an asterisk (*to the end of the package name.

import java.util.*;
public class MainClass{
   private int iValue;
}
1.4.import
1.4.1.You may import either an individual class from a package or the entire package.
1.4.2.White space and comments may appear before or after any of these elements.
1.4.3.To use classes with the same name in two different packages
1.4.4.Reference class without importing
1.4.5.Reference class with importing
1.4.6.Java compiler automatically imports all the classes in the java.lang package into every source file.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.