Results 1 to 4 of 4
  1. #1
    polymorphism is offline Member
    Join Date
    Nov 2007
    Posts
    1
    Rep Power
    0

    Default Help me Please..

    Hi all,

    Java Code:
    public interface ActionListener{
    public actionPerformed(ActionEvent e);
    }
    According above code the heading of the JButton method to associate itself with an ActionListener is

    Java Code:
    public void addActionListener(ActionListener aListener);
    So, Why was the parameter aListener chosen to be of an interface
    type in this header?


    I think that because the parameter aListener its type interface.

    What do you think??:)

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    Because we want to be able to use any class which implements ActionListener as an action listener. This way, user can easily define his/her own ActionListener by implementing this interface and can add it to any component.

  3. #3
    sha_5552002 is offline Member
    Join Date
    Nov 2007
    Posts
    1
    Rep Power
    0

    Default

    Hi am shankar.

    y the out object of printstream is defined inside system class?

  4. #4
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    It is just the standard output stream. You can use output stream of a socket or sth else as output stream too.

    By the way, please post your messages to the appropriate forum with appropriate titles. This is a rule on this forum and you accepted this rule when you registered.

Posting Permissions

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