aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Differences Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Differences" Watch "Differences" New topic
Author

Differences

chandra sekar
Greenhorn

Joined: Aug 19, 2008
Posts: 9
difference between BufferedWriter and Printwriter?

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

Joined: Aug 03, 2008
Posts: 9321
    
  17

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....


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
chandra sekar
Greenhorn

Joined: Aug 19, 2008
Posts: 9
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

Joined: Aug 19, 2008
Posts: 9
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

Joined: Aug 03, 2008
Posts: 9321
    
  17

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

Joined: Aug 07, 2008
Posts: 16
please refer : if it helps

http://www.coderanch.com/t/276763/Streams/java/BufferedWriter-PrintWriter
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14435
    
  23

chandra, please check your private messages. You can see them by clicking My Private Messages.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
V K Gupta
Ranch Hand

Joined: Aug 07, 2008
Posts: 55
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

Joined: Apr 28, 2008
Posts: 108
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 .


Cleared SCJP 1.5 | Cleared SCWCD 5.0
SCDJWS 6 in progress.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Differences