first they import the utilities needed for the function to properly examine the text in the website
Declare the class as URLExpSimple
They create a URL called mySite and set it equal to the website that they want to examine
Then they use the URLConnection to open the site so that it is able to be read
They set the Scanner to the name “in” and use the scanner to look through the website with the InputSteamReader
set the count equal to zero
Use a while loop to add to the count each time the string appears in the website
Print out the number of times that the count occurs using concatenation
And then close the scanner
I believe they use the printstacktrace in case their is no count to be added to
Here is a copy of what I wrote in the file:
Reading from a website
- first they import the utilities needed for the function to properly examine the text in the website
- Declare the class as URLExpSimple
- They create a URL called mySite and set it equal to the website that they want to examine
- Then they use the URLConnection to open the site so that it is able to be read
- They set the Scanner to the name “in” and use the scanner to look through the website with the InputSteamReader
- set the count equal to zero
- Use a while loop to add to the count each time the string appears in the website
- Print out the number of times that the count occurs using concatenation
- And then close the scanner
- I believe they use the printstacktrace in case their is no count to be added to
Here is a copy of what I wrote in the file:
Reading from a website