Quick HashMap Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xor

    Quick HashMap Question

    I'm doing up a school project using java, and am a little new to it (I've
    worked with other languages for years though).

    I've seen code posted by the instructor using HashMap like this...

    public HashMap<Positio n, Integer> boardNumbers;

    .... and ...

    HashMap<Integer , Integer> allNumbers = new HashMap<Integer , Integer>();


    .... when I go to compile this (on my windows box) it craps out and
    complains...


    Board.java:22: <identifier> expected
    public HashMap<Positio n, Integer> boardNumbers;

    .... and ...

    Board.java:55: not a statement
    HashMap<Integer , Integer> allNumbers = new HashMap<Integer ,
    Integer>();

    .... both have carrots pointing at the opening <

    is this a version issue or something? The school uses a unix environment,
    but I thought that shouldn't matter.
    Any help would be appreciated.

    thanks, dave


  • IchBin

    #2
    Re: Quick HashMap Question

    xor wrote:[color=blue]
    > I'm doing up a school project using java, and am a little new to it (I've
    > worked with other languages for years though).
    >
    > I've seen code posted by the instructor using HashMap like this...
    >
    > public HashMap<Positio n, Integer> boardNumbers;
    >
    > ... and ...
    >
    > HashMap<Integer , Integer> allNumbers = new HashMap<Integer , Integer>();
    >
    >
    > ... when I go to compile this (on my windows box) it craps out and
    > complains...
    >
    >
    > Board.java:22: <identifier> expected
    > public HashMap<Positio n, Integer> boardNumbers;
    >
    > ... and ...
    >
    > Board.java:55: not a statement
    > HashMap<Integer , Integer> allNumbers = new HashMap<Integer ,
    > Integer>();
    >
    > ... both have carrots pointing at the opening <
    >
    > is this a version issue or something? The school uses a unix environment,
    > but I thought that shouldn't matter.
    > Any help would be appreciated.
    >
    > thanks, dave
    >
    >[/color]
    You have to be running JDK\JRE 1.5. This format is new in 1.5. You must
    be running an earlier version say 1.4

    Uninstall your current Java version from the Add\remove program in the
    control panel.

    Then download and install latest version jdk1.5.0_06
    from http://www.java.com/en/download/index.jsp

    --


    Thanks in Advance...
    IchBin, Pocono Lake, Pa, USA

    _______________ _______________ _______________ _______________ ______________

    'If there is one, Knowledge is the "Fountain of Youth"'
    -William E. Taylor, Regular Guy (1952-)

    Comment

    • djchintu
      New Member
      • Feb 2006
      • 1

      #3
      Originally posted by IchBin
      xor wrote:[color=blue]
      You have to be running JDK\JRE 1.5. This format is new in 1.5. You must
      be running an earlier version say 1.4

      Uninstall your current Java version from the Add\remove program in the
      control panel.

      Then download and install latest version jdk1.5.0_06
      from http://www.java.com/en/download/index.jsp
      that's incorrect...


      though its too late now... its for someone else who may have the same error

      IchBin...

      make sure your class path is right...
      your classpath should be set to the directory you are working in rightnow

      Comment

      Working...