Input/Output in Java
Activity Outcomes:
Student will be able to:
1) Describe the concept of an I/O stream
2) Explain the difference between text files and binary files
3) Save data
4) Read data
In this lab you will experiment with the Java Input/Output components by implementing two programs that read input from a file and write output to a file.
The java.io package contains nearly every class you might ever need to perform input and output (I/O) in Java. All these streams represent an input source and an output destination. The stream in the java.io package supports many data such as primitives, object, localized characters, etc.
Lab Activities:
Activity 1:
Write a java program to get a files size in bytes?
Solution:
Activity 2:
Write a java program to get a files size in bytes?
Solution:
Activity 3:
Write a java program to change the last modification time of a file?
Solution:
Activity 4:
Write a java program to create a temporary file?
Solution:
Activity 5:
Write a java program to append a string in an existing file?
Solution:
Home Activities:
Activity 1:
Write a java program to copy one file into another file?
Activity 2:
Write a java program to delete a file?
Activity 3:
Write a java program to read a file?
Activity 4:
Write a java program to write into a file?