Skip to content

Commit

Permalink
Update FileAppend.java
Browse files Browse the repository at this point in the history
  • Loading branch information
adhilsalim committed Feb 23, 2023
1 parent 87cb7aa commit e19b269
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions 08 Copying content from one file to another/FileAppend.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,26 @@ public static void main(String[] args) {
FileInputStream fin;
FileOutputStream fout;

String temp="";

System.out.println("Enter the name of the file to read [excluding extension]: ");
String fRead = scan.nextLine();

//skipping new line
scan.nextLine();

System.out.println("Enter the name of the file to append [excluding extension]: ");
String fAppend = scan.nextLine();

scan.close();

try {
fin = new FileInputStream(fRead + ".txt");
fout = new FileOutputStream(fAppend + ".txt");
}catch(Exception err){}

int c = fin.read();

}
catch(Exception err){
System.out.println(err.getMessage());
}

}
}

0 comments on commit e19b269

Please sign in to comment.