Results 1 to 3 of 3
  1. #1
    kprime is offline Member
    Join Date
    Feb 2013
    Posts
    15
    Rep Power
    0

    Default import statement question

    Hi,

    I have a question about a particular import statement.
    Why is that I get a compiler error when I use the import statement:

    import java.awt.*;

    But not when I use:

    import java.awt.event.*;

    Basically in the first it's complaining that it cannot find the symbol ActionListener and ActionEvent. Doesn't import java.awt.* include everything in import java.awt.event?

    Thank you.

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

    Default Re: import statement question

    Quote Originally Posted by kprime View Post
    Doesn't import java.awt.* include everything in import java.awt.event?
    Indeed it doesn't; importing a package doesn't import anything in 'sub-packages'.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    kprime is offline Member
    Join Date
    Feb 2013
    Posts
    15
    Rep Power
    0

Similar Threads

  1. Problems with the import statement
    By mkarthik90 in forum Eclipse
    Replies: 0
    Last Post: 02-12-2012, 02:11 PM
  2. Quick question about import and inheretence
    By N00Bie in forum New To Java
    Replies: 3
    Last Post: 02-13-2011, 06:37 PM
  3. import statement
    By Sparky in forum New To Java
    Replies: 6
    Last Post: 02-02-2011, 08:30 AM
  4. question about import
    By alacn in forum New To Java
    Replies: 3
    Last Post: 08-15-2010, 04:50 AM
  5. import statement.
    By diRisig in forum New To Java
    Replies: 2
    Last Post: 02-08-2008, 12:34 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
  •