Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21746

Re: Reading a File

From Knute Johnson <nospam@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: Reading a File
Date 2013-01-26 11:41 -0800
Organization A noiseless patient Spider
Message-ID <ke1bge$37d$1@dont-email.me> (permalink)
References <4c68b43b-ee08-48fc-91fe-7f3f81213f69@vb8g2000pbb.googlegroups.com> <kdvpqt$539$1@dont-email.me> <a3fab57a-e94a-47c0-a634-c774a1a4f564@googlegroups.com> <1f99c3e0-3582-4487-8db2-af8c703c1222@googlegroups.com> <LAPMs.98358$Sl.33904@newsfe27.iad>

Show all headers | View raw


On 1/26/2013 4:01 AM, Arved Sandstrom wrote:
> On 01/26/2013 02:48 AM, Lew wrote:
>> subhaba...@... wrote:
>>> Thank you Sir. It worked. Regards,Subhabrata.
>>
>> Actually, no, it didn't, but the bugs are of a nature that doesn't
>> bother you yet.

How has it failed?  Sub seems to think it does the job he requires.

> Depends on how you run it as to whether that filename actually locates
> the source file.

There was no requirement or intent to 'locate' the source file.

> Overall the program itself "works". main() throws an exception, which
> may be acceptable for a console app. Hardcoding the filename isn't a
> defect unless you have a requirement to specify variable files.

There was no requirement for a GUI program.  There was no requirement to 
specify the file name.

> Having it in the default package ain't great, along with not using
> braces for the loop I'd nominate this as a latent defect.
>
> AHS

Being in the default package doesn't change its functionality or fail to 
meet any of Sub's requirements.  Adding unnecessary braces, while 
currently in vogue, does not change the program's functionality either 
and may in fact make it more complicated for Sub to understand.

His requirements were, no try/catch blocks and simple.  The code I 
provided meets Sub's requirements and "It worked."  Not only that I 
simplified his code example by removing the FileInputStream and the 
DataInputStream.

What you didn't mention is that there is no way to use anything but the 
default character set.  Heavens, how could you have forgotten that!

Clearly this is not a program Sub is going to use for anything except a 
place to start learning how to do simple I/O.  He has a long way to go 
and rather than critiquing my assistance you should have provided him a 
good example Arved.  If you want to contribute, give your competence to 
Sub, that's what you should be here to do anyway.

That's all I have to say about that.

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Reading a File Subhabrata <subhabangalore@gmail.com> - 2013-01-25 20:58 -0800
  Re: Reading a File Knute Johnson <nospam@knutejohnson.com> - 2013-01-25 21:33 -0800
    Re: Reading a File subhabangalore@gmail.com - 2013-01-25 21:53 -0800
      Re: Reading a File Lew <lewbloch@gmail.com> - 2013-01-25 22:48 -0800
        Re: Reading a File Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 08:01 -0400
          Re: Reading a File Lew <lewbloch@gmail.com> - 2013-01-26 10:12 -0800
          Re: Reading a File Knute Johnson <nospam@knutejohnson.com> - 2013-01-26 11:41 -0800
            Re: Reading a File Lew <lewbloch@gmail.com> - 2013-01-26 13:01 -0800
  Re: Reading a File Roedy Green <see_website@mindprod.com.invalid> - 2013-01-26 02:47 -0800

csiph-web