Link to home
Start Free TrialLog in
Avatar of edi02
edi02

asked on

Read a short text file into byte array

How to read a short text file (like "Hello World") in byte array?
ASKER CERTIFIED SOLUTION
Avatar of ThummalaRaghuveer
ThummalaRaghuveer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of edi02
edi02

ASKER

THis is what I get in javac:


C:\My Books\Java examples>javac Reader.java
Reader.java:5: cannot resolve symbol
symbol  : class FileInputStream
location: class Reader
               FileInputStream fip = new FileInputStream(new File("abc.txt"));
               ^
Reader.java:5: cannot resolve symbol
symbol  : class FileInputStream
location: class Reader
               FileInputStream fip = new FileInputStream(new File("abc.txt"));
                                         ^
Reader.java:5: cannot resolve symbol
symbol  : class File
location: class Reader
               FileInputStream fip = new FileInputStream(new File("abc.txt"));
                                                             ^
Reader.java:23: cannot resolve symbol
symbol  : class FileNotFoundException
location: class Reader
          } catch (FileNotFoundException e) {
                   ^
Reader.java:26: cannot resolve symbol
symbol  : class IOException
location: class Reader
          } catch (IOException e) {
                   ^
5 errors
Avatar of edi02

ASKER

OK, I was missing import java.io.*;
It works now