aspose file tools*
The moose likes Servlets and the fly likes Simple Question From Beginner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Simple Question From Beginner" Watch "Simple Question From Beginner" New topic
Author

Simple Question From Beginner

Pranit Saha
Ranch Hand

Joined: Sep 09, 2001
Posts: 130
I want to know what is the difference between URL and URI..
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Uniform Resource Locator(URL) is one type of Universal Resource Identifier (URI). There is another kind of URI called URN (Universal Resource Name). URNs r also resources but barely name only, used to define namespaces and some else.....u might already know well what URL is....

------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
BJ Grau
Ranch Hand

Joined: Jul 10, 2001
Posts: 234
Im not 100% sure, but here's my attempt at explaining it:
A URL is a concrete implementation of the abstract concept of an URI, and it defines the location of a resource on the Internet. There are many types of URLs such as ftp, http, gopher, etc.
To draw a picture showing the progression from abstract towards actual implementation, the order goes like this:
URI --> URL -->ftp, http, gopher, etc.
There are other types of URIs other than URL, such as URN. A URL is always a URI, but a URI is not necessarily a URL.

Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
I don't get it! then why is URL

Someone ???
BJ Grau
Ranch Hand

Joined: Jul 10, 2001
Posts: 234
Are you asking why the class URL is in the java.net package, and is a subclass of java.lang.Object? What I explained to you is what the difference between a URI and URL is. My explanation was not an explanation of the Java class URL, it was an explanation of URL and URI outside of Java. There is no URI class in Java that I know of.
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Originally posted by Dave Van Even:
[B]I don't get it! then why is URL

Someone ??? [/B]

This is basic Java heirarchy. By Default any class that doesn't extend any superclass then automatically inherits from java.lang.Object . Object class is the superclass of all classes, it is like the root class if you want to say

------------------
KaReEm


<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>
Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
i know, but if the Java Developers at SUN are as clever as BJ Grau (no flame intended) they would have subclassed URI from Object and URL from URI..
I'll quote BJ Grau
A URL is a concrete implementation of the abstract concept of an URI, and it defines the location of a resource on the Internet.

so you would say that, even if no implementation of URI is there yet, the developers would have sone

just being analytical
BJ Grau
Ranch Hand

Joined: Jul 10, 2001
Posts: 234
Ohhh I get it. Now that I read my post again I see how it looks. My explanation wasn't intended to describe the Java URL class, but I was using some Object Oriented concepts such as concrete and abstract to explain URI and URL. (Which by the way I am still not sure is 100% correct)

[This message has been edited by BJ Grau (edited September 15, 2001).]
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
A class can implement any interface and still not be its subclass. I mean a simple example would be if you write a class that implements Runnable, doesn't mean that it is a subclass of Runnable.
True statement :
If a class A implements B doesn't mean in no way that A is a Subclass of B.


------------------
KaReEm
Pranit Saha
Ranch Hand

Joined: Sep 09, 2001
Posts: 130
Still nobody made me clear about it..

Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Pranita ,
its clear , doesn't mean that a class implements another class that it is a subclass of it !
so it doesn't have to fall under the same heirarchy, w.r.t. inheritence.
------------------
KaReEm
Pranit Saha
Ranch Hand

Joined: Sep 09, 2001
Posts: 130
See i don't want the things abt inheritance and all.. i just want to know is there ne difference between URL and URI.. if it's there then tell me the exact difference..
Originally posted by Kareem Gad:
Pranita ,
its clear , doesn't mean that a class implements another class that it is a subclass of it !
so it doesn't have to fall under the same heirarchy, w.r.t. inheritence.

Poonam Akash
Ranch Hand

Joined: Jul 26, 2001
Posts: 100
Hi,
I too wanted to know this point as i am also new to this.I think Grau has tried lot but Maha and Tony must also say something on this....
Waiting for a good explaination....
Poonam.


Poonam Akash,<br />Sun Certified Java Programmer,<br />Sun Certified Web Component Developer.<br />Good luck may be an opportunity that keep the door open,BUT hardwork always keeps the door open!!
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236
Hi All,
I did a quick google search and found these links having simple and clear explanations.
What i understand from them is that a URL is a path to a resource(like a website) which is a collection of related documents and a
URI is a path to any document in a website.
for example,
www.javaranch.com is a URL and www.javaranch.com/ubb/forum33/HTML/00213.html is a URI.
Any way check out these links
www.javaranch.com/ubb/Forum33/HTML/000213.html and http://www.pierobon.org/iis/url.htm
Hope this helps,
Manjunath

[This message has been edited by Manjunath Subramanian (edited September 18, 2001).]
Poonam Akash
Ranch Hand

Joined: Jul 26, 2001
Posts: 100
Hi all!
Thanx Manjunath 4 the link u provide...I have read them that's really helped me to understand the D/F b/w the two!!
Thanx again!
Bye,
Poonam.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Question From Beginner