Should I use uri.toURL().openConnection();
since URL is deprecated from java 20
Path path = Paths.get(apiUrl);
URI uri = path.toUri();
HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection();
So, is this a good way of establishing connection? If not then what are the other ways of doing this?