This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes  how jvm understand that from which point print in newline while coping from file a to b ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark " how jvm understand that from which point print in newline while coping from file a to b ?" Watch " how jvm understand that from which point print in newline while coping from file a to b ?" New topic
Author

how jvm understand that from which point print in newline while coping from file a to b ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

mine mam told me that with this line we can tell jvm to print on next line , but i think there is something wrong with jvm ..lolz ..jokes apart but tell me whats wrong in this code
my file "a" contents are in single line mine question is , how jvm understands that from which point the text should be printed on a newline ?

what i want in file "b" is
in next line .
but it is giving me output on file 'b' is same as contents of file "a" .


[/code]


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

naved momin wrote: how jvm understands that from which point the text should be printed on a newline ?


The JVM doesn't decide where to put a newline. Your code does that. Do you understand what your code does? Under what circumstances will your code insert a newline into b.txt?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

Joe Ess wrote:
naved momin wrote: how jvm understands that from which point the text should be printed on a newline ?


The JVM doesn't decide where to put a newline. Your code does that. Do you understand what your code does? Under what circumstances will your code insert a newline into b.txt?

i didnt , understand i have a long text twice what i want is after every fullstop write in newline .

now this should be in file 'b' like
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

I fixed your input and output files. They were in one code block, which was confusing.

naved momin wrote:i didnt , understand i have a long text twice what i want is after every fullstop write in newline .


Why didn't your original post mention this requirement? The input file in your original post doesn't have any full stops.
Do you know how to look for a character in a String? Maybe looking through the JavaDoc for java.lang.String will inspire you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how jvm understand that from which point print in newline while coping from file a to b ?
 
Similar Threads
readLine() and read() functionality
Re: FileWriter write operation
Convert to BufferedReader & StringTokenizor...
why it is printing from start?
About printing and reading