Network_PassingURL1
Objectives :
  • getProtocol
  • getAuthority
  • getHost
  • getPath
  • getPort
  • getQuery
  • getFile
  • getRef

 

Complete Code :

/**
*
*/
import java.io.*;

import javax.swing.JOptionPane;

import java.net.URI;
import java.util.*;
import java.net.*;
//import java.util.stream.*;//
import java.util.Map.Entry;
/**
* @author Manas9
*
*/
public class ClassTemplate1 {
/**
*
*/
public ClassTemplate1() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args)
throws Exception {
// TODO Auto-generated method stub]
Process pr = new Process();
try {
pr.roller();

} catch (NumberFormatException exc) {
//Process
}
}
}
// end of class template
//
//Process implements interface A1
class Process
{
public Process()
{ System.out.println("Default constructor");}
public void roller()
{
try {
URL ulocal =
new URL("http://frontiersoft.net/BareBone_Oracle/index.htm");

System.out.println("protocol = " + ulocal.getProtocol());
System.out.println("authority = " + ulocal.getAuthority());
System.out.println("host = " + ulocal.getHost());
System.out.println("port = " + ulocal.getPort());
System.out.println("path = " + ulocal.getPath());
System.out.println("query = " + ulocal.getQuery());
System.out.println("filename = " + ulocal.getFile());
System.out.println("ref = " + ulocal.getRef());
} catch (NumberFormatException exc) {
//Process
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
// end of Class Process
 

Runtime View