Question
data.txt 1 2 3 4 5 6 7 8 9 10 11 12 13 LineCount.java /** This is a simple program to count the lines
data.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
LineCount.java
/**
This is a simple program to count the lines in a data file
*/
import javax.swing.* ;
import java.util.* ;
import java.io.* ;
public class LineCount
{
public static void main(String[] args)
{
//-----------Start below here. To do: approximate lines of code = 10
// Use a try{...}catch(){...} block and open a file "data.txt" using the File class.
// Create a Scanner object and pass in the File reference. Read the lines one at a time from the file
// and count them. Print "Number of lines: " followed by the line count
//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
System.out.println("Expected:Number of lines: 13");
}
}
Please have the expected output screenshotted and confirm that your code is formatted appropriately!
Step by Step Solution
3.41 Rating (170 Votes )
There are 3 Steps involved in it
Step: 1
This is a simple program to count the lines in a data file import javaxswing import jav...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Business Statistics In Practice
Authors: Bruce Bowerman, Richard O'Connell
6th Edition
0073401838, 978-0073401836
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App