Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36458
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: hash map |
| Date | 2017-04-17 09:10 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <od2ena$sf8$1@dont-email.me> (permalink) |
| References | <9a86c6fb-ae40-4acd-902f-afff0ab60fd6@googlegroups.com> <208075f0-0022-4996-b2b7-a3b90f6c85a6@googlegroups.com> <25389b66-b30f-4076-8f8e-4bfeb91dbc6f@googlegroups.com> |
On 4/17/2017 8:32 AM, pablo wrote:
> On Monday, 17 April 2017 13:11:35 UTC+1, Eric Douglas wrote:
>> On Sunday, April 16, 2017 at 2:54:02 PM UTC-4, pablo wrote:
>>> hi all i am trying to add to a hash map but i cant seem to do it could somebody look at the code and tell me why the hell i cant add the key and value
>>>
>>> import java.util.*;
>>> /**
>>> * The class Garage is used to hold data about a collection of customers.
>>> *
>>> * @author M250 module team
>>> * @version 1.0
>>> */
>>> public class Garage
>>> {
>>> //garage creating an empty instance of map map
>>> private Map<String,Customer> Customer = new HashMap<String, Customer>();
>>>
>>>
>>> public Garage()
>>> {
>>> Customer = new HashMap<>();
>>> }
>>>
>>> public void addCustomer(String Customer)
>>> {"
>>> Customer.Put(Andrew Smith, address 1 The High Street", area 1, "123ABC");
>>> }
>>
>> https://docs.oracle.com/javase/tutorial/collections/interfaces/map.html
>> https://www.tutorialspoint.com/java/java_hashmap_class.htm
>> http://beginnersbook.com/2013/12/hashmap-in-java-with-example/
>
> private Map<String,String> map = new HashMap<String, String>();
> map.put("Andrew Smith, address 1 The High Street, area 1");
>
> my compiler keeps saying <identifier> expected
Are you certain that what you've shown us is exactly the same code
you gave to the compiler? My compiler also complains, but not about a
missing <identifier>. Instead, I get a flurry of ten complaints about
"unclosed string literal" and "illegal start of expression" and "not a
statement" and so on, all concerning the botched final three lines.
(Other errors are apparent to my eye, but I imagine the compiler gave
up before its analysis got that far.)
Please re-check your source code, and post *exactly* what you gave
to the compiler (and *exactly* what the compiler said in reply). If we
must guess about what the code looks like, we'll wind up debugging our
guesses for you instead of debugging your code.
--
esosman@comcast-dot-net.invalid
Thirteen hundred seventy-four days to go.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
hash map pablo <pa24959122@gmail.com> - 2017-04-16 11:53 -0700
Re: hash map Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-16 19:10 +0000
Re:hash map omegajunior <omegajunior@protonmail.com> - 2017-04-16 17:11 -0400
Re: hash map pablo <pa24959122@gmail.com> - 2017-04-17 04:31 -0700
Re: hash map Eric Douglas <e.d.programmer@gmail.com> - 2017-04-17 05:11 -0700
Re: hash map pablo <pa24959122@gmail.com> - 2017-04-17 05:32 -0700
Re: hash map Eric Douglas <e.d.programmer@gmail.com> - 2017-04-17 05:58 -0700
Re: hash map Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-04-17 09:10 -0400
Re: hash map pablo <pa24959122@gmail.com> - 2017-04-17 06:53 -0700
Re: hash map Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-04-17 10:15 -0400
Re: hash map pablo <pa24959122@gmail.com> - 2017-04-17 07:25 -0700
Re: hash map Eric Douglas <e.d.programmer@gmail.com> - 2017-04-17 07:46 -0700
Re: hash map Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-04-17 10:54 -0400
Re: hash map pablo <pa24959122@gmail.com> - 2017-04-17 08:29 -0700
Re: hash map Eric Douglas <e.d.programmer@gmail.com> - 2017-04-17 08:44 -0700
Re: hash map Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-04-17 12:07 -0400
Re: hash map pablo <pa24959122@gmail.com> - 2017-04-17 09:32 -0700
Re: hash map Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-17 23:14 +0000
Re: hash map Arne Vajhøj <arne@vajhoej.dk> - 2017-04-17 20:22 -0400
Re: hash map Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-18 01:20 +0000
Re: hash map Arne Vajhøj <arne@vajhoej.dk> - 2017-04-18 20:01 -0400
Re: hash map Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-19 09:02 +0000
Re: hash map Eric Douglas <e.d.programmer@gmail.com> - 2017-04-18 04:54 -0700
Re: hash map Arne Vajhøj <arne@vajhoej.dk> - 2017-04-18 20:03 -0400
Re: hash map Martin Gregorie <martin@address-in-sig.invalid> - 2017-04-19 08:55 +0000
Re: hash map Eric Douglas <e.d.programmer@gmail.com> - 2017-04-19 04:45 -0700
Re: hash map Arne Vajhøj <arne@vajhoej.dk> - 2017-04-18 20:05 -0400
csiph-web