The following program contains 6 mistakes! What are they? public class Oops6 { public static void main
Question:
The following program contains 6 mistakes! What are they?
Transcribed Image Text:
public class Oops6 { public static void main (String [] args) { 3 Scanner in = new Scanner ("example.txt"); 4 countWords (in); 7 // Counts total lines and words in the input scanner. public static void countWords (Scanner input) { Scanner input = new Scanner ("example.txt"); 10 int lineCount = 0; 11 int wordcount = 0; 12 13 while (input.nextLine ()) { 14 String line = input.line (); // read one line 15 lineCount++; 16 while (line.next ()) { 7/ tokens in line 17 String word line.hasNext; 18 wordCount++; 19 20 21 22 2. CO
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (10 reviews)
Mistakes in Oops6 program 1 line 2 main method must say throws FileNotFoundException when const...View the full answer
Answered By
Charles mwangi
I am a postgraduate in chemistry (Industrial chemistry with management),with writing experience for more than 3 years.I have specialized in content development,questions,term papers and assignments.Majoring in chemistry,information science,management,human resource management,accounting,business law,marketing,psychology,excl expert ,education and engineering.I have tutored in other different platforms where my DNA includes three key aspects i.e,quality papers,timely and free from any academic malpractices.I frequently engage clients in each and every step to ensure quality service delivery.This is to ensure sustainability of the tutoring aspects as well as the credibility of the platform.
4.30+
2+ Reviews
10+ Question Solved
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted:
Students also viewed these Computer science questions
-
The following program contains 9 mistakes! What are they? public class Oops2 { 2. public static void main (String [] args) { 3 int x; 4 System.out.println ("x is" x); int x = 15.2; // set x to 15.2...
-
The following program contains 7 mistakes! What are they? What output is produced for each of the following calls? a. IfElseMystery1(3, 20); b. IfElseMystery1(4, 5); c. IfElseMystery1(5, 5); d....
-
The following program contains at least 10 syntax errors. What are they?
-
In Exercises simplify the ratio of factorials. (n + 1)! n!
-
A spring - loaded piston-cylinder device contains 1 kg of carbon dioxide. This system is heated from 100 kPa and 25oC to 1000 kPa and 300oC. Determine the total heat transfer to and work produced by...
-
The North Valley Real Estate data reports information on homes on the market. a. Determine the proportion of homes that have an attached garage. At the .05 significance level, can we conclude that...
-
Blue and yellow streams of paint at \(60^{\circ} \mathrm{F}\) (each with a density of \(1.6 \mathrm{slugs} / \mathrm{ft}^{3}\) and a viscosity 1000 times greater than water) enter a pipe with an...
-
Teak Outdoor Furniture manufactures wood patio furniture. The company reports the following costs for June 2012: Wood . . . . . . . . . . . . . . . . . . . . . . . . $ 250,000 Nails, glue, and stain...
-
A force of F = 1 5 0 N is applied at 3 0 o West of North . what is the x component of the force ?
-
1. How comparable are the two different methods? In what ways are they similar? In what ways are they different? 2. What are the positive and negative aspects of each approach that Shocker should...
-
For the next several questions, consider a file called readme.txt that has the following contents: What would be the output from the following code when it is run on the readme.txt file? 6.7 This...
-
Modify the preceding wordWrap method so that it only wraps whole words, never chopping a word in half. Assume that a word is any whitespace-separated token and that all words are under 60 characters...
-
What is a precondition of the iterators remove method? How does the iterator enforce this precondition, and what does it do if the precondition is violated?
-
Describe the different demographic trends of interest to sports marketers. How will these demographic trends influence the strategic marketing process?
-
Your universitys athletic program has a number of competitors. List all potential competitors and categorize what type of competition each represents.
-
What are Keyness social influences on financial herding? Which of these influences do you think has the most impact on modern financial markets and thus on the macroeconomy? Illustrate with examples.
-
Describe all the ways the changing marketing environment will have an impact on NASCAR racing. How should NASCAR prepare for the future?
-
Behavioural finance focuses on numbers of reasons why real-world financial markets do not fit with the assumptions about efficient financial markets. Explain what is meant by an efficient financial...
-
A gas, while expanding under isobaric conditions, does 480 J of work. The pressure of the gas is 1.6 105 Pa, and its initial volume is 1.5 10-3 m3. What is the final volume of the gas?
-
The comparative statements of financial position of Menachem NV at the beginning and end of the year 2019 appear below. Net income of ¬34,000 was reported, and dividends of ¬23,000 were paid...
-
How long will it take to transmit a 1-GB file from one VSAT to another using a hub as shown in Figure 2-17? Assume that the up link is 1 Mbps, the down link is 7 Mbps, and circuit switching is used...
-
Calculate the transmit time in the previous problem if packet switching is used instead. Assume that the packet size is 64 KB, the switching delay in the satellite and hub is 10 microseconds, and the...
-
In Fig. 2-40, the user data rate for OC-3 is stated to be 148.608 Mbps. Show how this number can be derived from the SONET OC-3 parameters. What will be the gross, SPE, and user data rates of an...
-
How do the resource descriptions (typing) used in the Incident Command System lead to a more effective response?
-
A company incurs $4172000 of overhead each year across three departments: Ordering and Receiving, Mixing, and Testing. The company prepares 2000 purchase orders, works 50000 mixing hours, and...
-
Hemming Company reported the following current-year purchases and sales for its only product. Date January 1 January 10 Activities Beginning inventory March 14 March 15 July 30 Sales Purchase Sales...
Study smarter with the SolutionInn App