In this section we are going to describe, how to
retieve the value of the URL assign to the url object. Here is the complete code
of the program in which first of all we establish a connection then display it.
In the example we open the connection by using the openConnection()
method. After that we use the getURL() which returns the value of this URLConnection's
URL field to display the assign URL.
Here is the Output of the Example :
import java.net.*;
|
Here is the Output of the Example :
| C:\roseindia>javac printURLConnection.java C:\roseindia>java printURLConnection http://roseindia.net/ |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Print the URL of a URLConnection
Post your Comment