aw1231
  • aw1231
How do I use java to read a simple offline html file?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
How do you want to read it? I have some file I/O demos if you want to see them....
aw1231
  • aw1231
I want it to scan for a certain phrase with a number and output that number.
anonymous
  • anonymous
In Java you can connect an instance of Scanner to an instance of FileInputStream and pass in the file name or path. Then you can use the nextLine() method to grab a line of text as a String from your HTML file. Example lines: import java.util.* ; import java.io.* ; Scanner inputStream = new Scanner(new FileInputStream("HTMLfilename.html")); while(inputStream.hasNextLine()) { String theLine = inputStream.nextLine(); // do your checks to see if your string has the phrase you want here } inputStream.close(); I included an example File I/O program from one of my instructors below for you to run. Good luck.

Looking for something else?

Not the answer you are looking for? Search for more explanations.