0

My code is as follows:

LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();

I am getting error:

not a statement

I included java.util.LinkedHashMap package and am using JDK version 4.1.2

9
  • You haven't provided enough context. Please provide a minimal reproducible example. Commented Jan 30, 2016 at 9:18
  • 1
    I've never even heard of a JDK version 4.1.2. Could you provide a link to the place you downloaded it? Commented Jan 30, 2016 at 9:19
  • Sorry, the correct version is J2RE 1.4.2 Commented Jan 30, 2016 at 9:22
  • LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("src", srcPnoneNumber); // Sender's phone number with country code parameters.put("dst", receiverPhoneNos); // Receiver's phone number with country code, The numbers are separated by "<" delimiter. parameters.put("text", message); // Your SMS text message parameters.put("method", "GET"); // The method used to call the url // Send the messages MessageResponse msgResponse = api.sendMessage(parameters); Commented Jan 30, 2016 at 9:22
  • 1
    Then the comments suggesting that you're trying to use generics with a version that doesn't support them are correct. More importantly, why are you using such an ancient version? And please don't dump code in comments like that - when you're asked for clarifications, you should put the information in the question. Commented Jan 30, 2016 at 9:22

2 Answers 2

1

Generics have been introduced in Java 5.

This feature (and the associated syntax) is not available in Java 1.4.

Sign up to request clarification or add additional context in comments.

Comments

1

In JDK 1.4 (4) generics were not supported yet. Avoid the <> parts:

LinkedHashMap parameters = new LinkedHashMap();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.