Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: hash map Date: Mon, 17 Apr 2017 09:10:57 -0400 Organization: A noiseless patient Spider Lines: 53 Message-ID: References: <9a86c6fb-ae40-4acd-902f-afff0ab60fd6@googlegroups.com> <208075f0-0022-4996-b2b7-a3b90f6c85a6@googlegroups.com> <25389b66-b30f-4076-8f8e-4bfeb91dbc6f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 17 Apr 2017 13:07:54 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="1c8b00ef01e12dbc4943e72d9f05af11"; logging-data="29160"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8Sj6MnQV/D3tjrsizeKw1" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <25389b66-b30f-4076-8f8e-4bfeb91dbc6f@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:VichiH8NtBWV1P70qMO0wlSqrrw= Xref: csiph.com comp.lang.java.programmer:36458 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 Customer = new HashMap(); >>> >>> >>> 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 map = new HashMap(); > map.put("Andrew Smith, address 1 The High Street, area 1"); > > my compiler keeps saying 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 . 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.