Results 1 to 4 of 4
  1. #1
    XmisterIS is offline Member
    Join Date
    Aug 2010
    Posts
    35
    Rep Power
    0

    Default * vs. individual package name?

    let's say all I want to use from the package java.awt.event is the ActionListener interface.

    Which of the following two is faster:

    import java.awt.event.*;

    or

    import java.awt.event.ActionListener;

    Or doesn't it make any difference?

    Also, does the order of importing things make a speed difference?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Clarity for the programmer. There is no performance difference as all they do is allow the programmer to refer to a class using the "shortname" rather than the fully qualified name when programming. Once the class is compiled the imports are non-existent, so any "performance" difference is only during compilation, anyway.

  3. #3
    XmisterIS is offline Member
    Join Date
    Aug 2010
    Posts
    35
    Rep Power
    0

    Default

    Many thanks!

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by masijade View Post
    Clarity for the programmer. There is no performance difference as all they do is allow the programmer to refer to a class using the "shortname" rather than the fully qualified name when programming. Once the class is compiled the imports are non-existent, so any "performance" difference is only during compilation, anyway.
    But most of the people think it cause to the performance drop of the application. Looking at the OPs questions too it seems.

Similar Threads

  1. Replies: 1
    Last Post: 07-10-2010, 04:21 AM
  2. Replies: 7
    Last Post: 11-09-2009, 07:51 AM
  3. Replies: 0
    Last Post: 03-09-2009, 06:55 PM
  4. Calculating Individual Numbers
    By TheKnight in forum New To Java
    Replies: 2
    Last Post: 01-30-2009, 12:51 AM
  5. Combining Individual Sounds - Urgent
    By JDCAce in forum Advanced Java
    Replies: 4
    Last Post: 12-05-2008, 05:17 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
  •