Anil Kumar.C
Anil Kumar.C

Reputation: 267

URL Object is not recognized

I am writing a web service similar to below. But Java is not recognizing the URL, URLConnection. I am unable to solve this issue.

URL yahoo = new URL("http://www.yahoo.com/");
URLConnection yc = yahoo.openConnection();
int dataLen = yc.getContentLength() ;

Upvotes: 0

Views: 283

Answers (1)

McDowell
McDowell

Reputation: 108959

This code is Java, not JavaScript. I am guessing that you have not imported the classes from the java.net package.

Upvotes: 1

Related Questions