Professional Documents
Culture Documents
6 4 A P 603ca0622252f File
6 4 A P 603ca0622252f File
Written by
1. Program on IO Exception
2. Program to create file
3. Program to copy contents of one file to another using Byte Stream
4. Program to copy contents of one file to another using Character Stream
Key takeaways
Siddhesh Ashok Vaidya
Creation of Files Lecturer, Department of Computer Engineering (NBA Accredited), Vidyalankar Polytechnic,
Mumbai
Copying contents of files
► Understand concept of creation of files, copying contents of files using Byte Streams and Character
Streams
import java.io.*;
public class AddTwoNumbers
{
public static void main(String[] args) throws IOException
{
int num1, num2, sum;
DataInputStream d = new DataInputStream(System.in);
System.out.println("Enter First Number: ");
num1 = Integer.parseInt(d.readLine());
System.out.println("Enter Second Number: ");
num2 = Integer.parseInt(d.readLine());
sum = num1 + num2;
System.out.println("Sum of these numbers: "+sum);
}
}
IO Exception
Creation of Files