0

This is my code for reading in the file

Scanner inFile = null;
try {
    File file = new File("/Users/ChrisMyers/Desktop/res2.rtf");
    inFile = new Scanner(file);
    String line;
    while (inFile.hasNextLine())
    {
        line = inFile.nextLine();
        System.out.println(line);
    }
    inFile.close();
} catch (FileNotFoundException e) {
    System.out.println("File " + " not found!");
}

and this is what it prints out:

{\rtf1\ansi\ansicpg1252\cocoartf1504
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;\csgray\c100000;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0

\f0\fs24 \cf0 what\
what\
what\
what}

I just want it to print out

what
what
what 
what

all on separate lines.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Yikes
  • 1
  • 1

0 Answers0