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?  

 
LVL 1
HLRosenbergerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HLRosenbergerAuthor Commented:
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.
0
VenabiliCommented:
The sun.net one extend the standard one. Both of them are from a long time ago. See http://java.sun.com/developer/onlineTraining/protocolhandlers/ for some history.

Keep in mind that all the sun packages are not official, public, supported ones. So they can change at any time... Not ot mention that they might not be working across platforms sometimes.

See the last posts here: http://forums.sun.com/thread.jspa?threadID=473559 for example for a bigger explanation

NetBeans will show anything from the jars that you have in the classpath. The sun package is there because this is the Sun implementation of things. But I would not use it unless if I have no choice :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

HLRosenbergerAuthor Commented:
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.
0
centicCommented:
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
0
VenabiliCommented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.