Code: Select all
public class URLConClient {
public static void main(String[] args) throws IOException {
URL restURL = new URL("http://localhost:8080/SimpleRS/jax/rs/add/5/6");
URLConnection connection = (URLConnection) restURL.openConnection();
// 1
readFrom(connection);
}
}
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setReadTimeout(10000);
connection.setDoOutput(true);
connection.setDoInput(false);
connection.setDoOutput(true) is not required as we're not writing out anything from the client. The explanation says the same thing as well but still it's marked as one of the correct options. Why?