Which Java statements read all words from a text file, and prints the first character of each word? Assume the following statement is given: Scanner fscan = new Scanner(new File("data.txt")); Lütfen...


Which Java statements read all words from a text file, and prints the first character of each word?


Assume the following statement is given:


Scanner fscan = new Scanner(new File("data.txt"));
Lütfen birini seçin:
a. None of the others
b.
while (fscan.hasNextLine())
{
String word = fscan.nextLine();
System.out.print(word.charAt(0));
}
fscan.close();

c.
while (fscan.hasNext())
{
String token = fscan.next();
System.out.print(token.charAt(0));
}
fscan.close();

d.
while (fscan.hasNext())
{
String word = fscan.next();
System.out.print(word[0]);
}
fscan.close();

e.
while (fscan.hasNext())
{
String word = fscan.next();
System.out.print(word);
}
fscan.close();



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here