'URL' is a class. Use 'new' to create a new instance of the class URL and pass the string myUrl as a parameter to the constructor.
String myUrl = "https://intellipaat.com";
URL myURL = new URL(myUrl);
If you want to learn Java, then check out this Java Certification program by Intellipaat.