Results 1 to 4 of 4

Thread: what is <....>

  1. #1
    anitha2324 is offline Member
    Join Date
    Jul 2008
    Posts
    5
    Rep Power
    0

    Exclamation what is <....>

    Hi All,

    am newbie to java , i have read some code examples and i have found some declaration like this

    Hashtable<String, String> properties = new Hashtable<String, String>();
    or something like
    private static HashMap<String,JMSSenderTest> jmsSenders = new HashMap<String,JMSSenderTest>();


    i am not able to understand what is meaning of that especially about the <String,String>


    so what does the symbol <....> indicates

    sorry for the silly question

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,412
    Rep Power
    25

    Default

    That syntax is part of the Generic coding for java. Go to the Sun's tutorial and read up.
    Generics is a way of telling the compiler how you are going to use a class and have the compiler check that you use it correctly.
    Many of the classes that use the Generic coding technique allow the use of Objects and are prone to problems with type casting and wrong types being used. Generics allows the compiler to check on the coder's use of a class.

  3. #3
    Jeremy is offline Member
    Join Date
    Jul 2008
    Posts
    28
    Rep Power
    0

    Default

    Those brackets signify parametrized type definitions. If you want an ArrayList of Strings then you would define it as such:

    Java Code:
    ArrayList<String> list = new ArrayList<String>();
    The code example you have is a map of key-value pairs where the keys are Strings and the values are JMSSenderTest.

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

Posting Permissions

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