Reputation: 483
Sorry this is a simple question and I can't find what I'm looking for probably because I don't know what the keywords are.
For example I have a read.java that should be able to read how many A's there in a file called quotes.txt when I redirect the file: read < quotes.txt
How do I read from quotes.txt in java?
Upvotes: 1
Views: 49
Reputation: 51030
You can use new Scanner(System.in)
. It will be available as Standard Input Stream for read
, represented by System.in
, which is a InputStream
.
You can also do
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
and use that br
.
Upvotes: 1