Results 1 to 4 of 4
  1. #1
    martijnburger is offline Member
    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0

    Default Problem understanding class statement.

    Hi,

    I am havind trouble understanding the class statement below. Especially What the <D> after class Presenter means. Can someone point explain or point me to some documentation that covers this subject?

    Java Code:
    abstract public class Presenter<D> {
      private String params;
      private D display;
      private Environment environment;
    
      private KeyValueMap kvm;
    
      public Presenter() {
      }
    
      public Presenter(
          String someParams, D aDisplay, Environment anEnvironment) {
        super();
        params = someParams;
        display = aDisplay;
        environment = anEnvironment;
        kvm = new KeyValueMap(params);
      }

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    The <D> is a generic type specifier. See Generic Types.

    I can't really help with your understanding of the rest of the declaration unless you explain which part you don't understand.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,789
    Rep Power
    25

    Default

    <D> is generic notation. It has to do with allowing the compiler to do type checking.
    Go to this site, find Generics and read about it:The Really Big Index

  4. #4
    martijnburger is offline Member
    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0

    Default

    Great guys! Thanks for the quick replies, I'll look into the documentation, just couldn't find out what it was called.

Similar Threads

  1. Problem understanding basic Simple Enumerators
    By eLancaster in forum New To Java
    Replies: 31
    Last Post: 06-23-2011, 07:38 PM
  2. Understanding -- new Class() -- syntax.
    By AcousticBruce in forum New To Java
    Replies: 8
    Last Post: 12-14-2010, 01:53 AM
  3. Replies: 9
    Last Post: 09-21-2010, 05:15 PM
  4. Having trouble understanding Class Graphic
    By Bernard Robitaille in forum JCreator
    Replies: 1
    Last Post: 04-18-2009, 03:55 AM
  5. Replies: 3
    Last Post: 10-07-2008, 12:03 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
  •