Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

Is sun.net.www.protocol.http.HttpURLConnection the same class as java.net.HttpURLConnection?

Does anyone know if the sun.net.www.protocol.http.HttpURLConnection  if the same class and/or provides the same functionality as java.net.HttpURLConnection?  

 
Avatar of Venabili
Venabili
Flag of Bulgaria image

Avatar of HLRosenberger

ASKER

No reason at all.  I was wondering if they are the same.  If I do CTRL-SHIFT-I in NetBeans to correct missing imports, if gives me a choice to select either one.   So, I was just wondering why there are two HttpURLConnection classes and if they are the same.
ASKER CERTIFIED SOLUTION
Avatar of Venabili
Venabili
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.  I was not planning on using it.  I'm relatively new to Java, and was just curious why the two classes wiht the same name.
Avatar of centic
centic

In general any sun.* class is only used internally by the Java VM and is not intended to be used by a normal Java application. Sun does specifically not guarantee that the APIs for these classes will stay in-tact between versions. So the java.net.... classes are the ones that you usually use and they might internally use the ones from sun.www....,

HTH... Dominik
Author Comments:
Thanks. I was not planning on using it. I'm relatively new to Java, and was just curious why the two classes wiht the same name.
===grading comment is not visible for anyone besides me and you at the moment so just posting it)

Welcome in Java - it is interesting over here most of the time:) Basically you will see a lot of same named classes in different packages- that's one of the reasons why I always say that people should always import classes and not full packages - same named classes popup in strange places. And then the sun. package is a usual catch for a lot of new programmers - while sometimes you cannot avoid it, in general you should be able to. And when I cannot I usually write my own implementation in most cases. :)

Anyway - good luck with your Java.