getResponsemethod of the Magpie class.
java.net.URLConnectionlibraries be imported.
MalformedURLException. You can handle this with either a try/catch block or adding
throws MalformedURLExceptionto the method header and importing the exception. Different teachers may have different preferences; either works. Similarly, the
openConnectionmay throw an
IOExceptionthat should be handled before moving on. If you opt to throw the error, be sure to also handle it in the runner.
java.io.OutputStreamWriter. Notice the line being written is the same as the data provided to the API Explorer in Part 0.