• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differences

 
chandra sekar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
difference between BufferedWriter and Printwriter?

what is meant by serialization? and what is the purpose of using this?
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chandra:
difference between BufferedWriter and Printwriter? (I don't know I/O)


Originally posted by chandra:

what is meant by serialization? and what is the purpose of using this?


serialization is the process of writing state of an object to a file or some other resource so that even if your program ends and you run it again, your object will be in the same state as it was before the program ended....
 
chandra sekar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
serialization
i cant understand this. what is meant by state of the object? can you please clearly explain?

I am asking I/O streams ( BufferedWriter and PrintWriter)
 
chandra sekar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
serialization
i cant understand this. what is meant by state of the object? can you please clearly explain?

I am asking I/O streams ( BufferedWriter and PrintWriter)
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
state of an object is the value of its instance variables..

and yes I don't know I/O related classes properly...someone will soon explain you about them................
 
Sanjeev Dubey
Greenhorn
Posts: 16
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chandra, please check your private messages. You can see them by clicking My Private Messages.
 
V K Gupta
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basic difference b/w BufferedWriter and PrintWriter is about its constructor and methods.

1) Both the classes are extended from Writer Class

2) BufferedWriter constructor can only take Writer class as its argument.

3) PrintWriter constructor can take different arguments like File,String,Writer

4) BufferedWriter class have only one write() method to write into the file and newLine() method which puts
the default newLine character in the file.

5) PrintWriter class have many write methods like, format(), printf(), println(), print(), write().

You should see the java documentation for more details.
 
ankit kumar
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BufferedWriter classis the top level class or can say the Wrapper class

PrintWriter is low level class we can Wrap it with high levbel class and get the function from the top level class .BufferedWriter constructor takes a PrintWriter object as a parameter .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic