Results 1 to 3 of 3
  1. #1
    eel
    eel is offline Member
    Join Date
    Sep 2010
    Posts
    36
    Rep Power
    0

    Exclamation Help with import

    May I know when do we need to use below import? For which method do we need to use below import?
    import java.util.*;
    import java.io.*;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.lang.*;

    Thanks.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by eel View Post
    May I know when do we need to use below import? For which method do we need to use below import?
    import java.util.*;
    import java.io.*;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.lang.*;

    Thanks.
    The import statements above import entire classes or even entire packages (with all the classes in them). Nobody knows what methods in those classes you want to use.

    kind regards,

    Jos

    ps. there is no need to import the java.lang package; it is conceptually imported by the compiler automatically. There is also no need to import an entire package and some classes from that package separately.
    Last edited by JosAH; 09-19-2010 at 10:18 AM.

  3. #3
    eel
    eel is offline Member
    Join Date
    Sep 2010
    Posts
    36
    Rep Power
    0

Similar Threads

  1. Import
    By gothrog in forum Java Applets
    Replies: 2
    Last Post: 05-13-2010, 11:16 PM
  2. Can not import jxl.*
    By AnnieDing in forum Java Servlet
    Replies: 3
    Last Post: 01-22-2010, 03:52 PM
  3. import error
    By amarenash23 in forum New To Java
    Replies: 2
    Last Post: 01-15-2010, 11:32 AM
  4. can't import my own class
    By Splat in forum New To Java
    Replies: 5
    Last Post: 10-13-2009, 04:53 AM
  5. can any one help?? how to import library
    By libish in forum New To Java
    Replies: 5
    Last Post: 02-12-2009, 06:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •