Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Formatter;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- try {
- Formatter frank = new Formatter("F:/frank.txt");
- Formatter april = new Formatter("F:/april.txt");
- FileInputStream file = new FileInputStream("F:/script.txt");
- Scanner sc = new Scanner(file);
- while( sc.hasNext() ) {
- String line = sc.nextLine();
- if( line.length() != 0 ) {
- if( line.charAt(0) == 'F' ) {
- frank.format("%s\r\n", line );
- }
- else if( line.charAt(0) == 'A' ) {
- april.format("%s\r\n", line);
- }
- }
- }
- sc.close();
- frank.close();
- april.close();
- }
- catch ( Exception e ) {
- System.out.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement