When I try to instantiate an object from the URL class like this:
URL myURL = new URL("http://example.com");
the compiler arise and error:
error: constructor URL in class URL cannot be applied to given types;
and points to the key work 'new' in the line above. The all class is:
import java.net.*;
import java.io.*;
public class URL {
public static void main(String[] args) {
URL myURL = new URL("http://example.com");
String protocl = myURL.getProtocol();
System.out.println(protocol);
}
}
plz help !!
java.net.URLclass that you imported. Don't name your classURL.