Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.erje.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: blmblm@myrealbox.com Newsgroups: comp.lang.java.programmer Subject: Re: The greeting code in Java Date: 21 Jun 2011 20:43:12 GMT Organization: None Lines: 44 Message-ID: <96ce30Fc6lU4@mid.individual.net> References: <3d6aab49-9a4a-4614-af12-bb1c95bebbe7@w4g2000yqm.googlegroups.com> <969l09FjduU8@mid.individual.net> X-Trace: individual.net AXFJYAx1C9Kt+86LieGfdQUDuIDQBI/WDWIF6+j6j22RYnDkdi X-Orig-Path: not-for-mail Cancel-Lock: sha1:Q9UXWXb94Qhg1Tgs4De7e4mYvec= X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5484 In article , Tobias Blass wrote: > On 2011-06-20, blmblm myrealbox.com wrote: > > In article , > > Jeff Higgins wrote: > >> > >> On 06/19/2011 02:36 PM, Saeed Amrollahi wrote: > >> > On Jun 19, 6:31 pm, Jeff Higgins wrote: > >> >> On 06/19/2011 09:06 AM, Saeed Amrollahi wrote: > >> >> > >> >>> What are the problems of my code and how can I write > >> >>> a better one. Please throw some light. > >> >> > >> >> What means better? > >> > > >> > For example using less abstractions and less involve with Java > >> > stream class hierarchy. > >> > >> For a beginner, learning to write C in Java is unhelpful. > > > > Even in C one would not be likely to input a string by reading one > > charaacter at a time -- in a beginner program at least. s/charaacter/character/, of course (why do these details only become apparently *after* posting?) > Hmm at least in K&R (the inofficial standard C learning book) you often find > while((c=getchar())!=EOF) > > It's less performant than reading whole blocks but in many cases much simpler > (And that's what matters in a learning book) Well, if you say so (my copy of K&R is not easily accessed right now). Certainly that style makes sense in examples in which the goal is to process a character at a time (to classify/count characters, for example, or to copy one file to another). But is this style used in examples in which the objective is to collect one whitespace-delimited "string" and print it? Huh. Maybe I need to reread K&R .... -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.