using java? how i'm going to get the data in notepad. in short of file streaming?

Recommended Answers

I'm not entirely sure what you mean..

Java IO takes care of reading and writing to files and such.

I suggest looking up the BufferedWriter class for writing and BufferedReader for reading.

Jump to Post

By "data in notepad" do you mean a ".txt" file?
That data can be easily read using the FileInputStream or PrintStream

Jump to Post

All 7 Replies

I'm not entirely sure what you mean..

Java IO takes care of reading and writing to files and such.

I suggest looking up the BufferedWriter class for writing and BufferedReader for reading.

Yes!..can you show me a sample code in file streaming in java?

getting data in notepad.

here u go!
Hope this simple code is informative for you!

import java.io.*;
import java.util.*;

class test
{

	public static void main(String ar[])
	{
		try(FileInputStream f=new FileInputStream("myTxT.txt"))
		{
			Scanner in=new Scanner(f);
			while(in.hasNext())
			{
				System.out.println(in.nextLine());
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
	}
}

thanks a lot.. i really want to learn how to apply file streaming using java. :)

Mark this thread as solved, if u have got answers for your questions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.