Я пишу этот код:
import java.net.HttpURLConnection;
import java.net.URL;
public class Main{
private static HttpURLConnection connection;
public static void main(String[] args){
final URL url = new URL (spec: "https://google.com");
connection = (HttpURLConnection) url.openConnection();
connection =url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
int status = connection.getResponseCode();
system.out.println(status);
}
}
И получаю эту ошибку:
Main.java:8: error: ')' expected
Я работаю с OpenJdk:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
и UBUNTU 18.04
Спасибо за любую помощь