• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Simple Question From Beginner

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to know what is the difference between URL and URI..
 
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't get it! then why is URL

Someone ???
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Dave Van Even
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still nobody made me clear about it..

 
Kareem Gad
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic