Give the example of using a class from the class library, JAVA Programming

Assignment Help:

Give the example of Using a class from the class library ?

You use the java.net.URL class only like you'd use any other class along with these methods in which happens to be named java.net.URL. For example,
public class URLSplitter {

public static void main(String[] args) {

for (int i = 0; i < args.length; i++) {
try {
java.net.URL u = new java.net.URL(args[i]);
System.out.println("Protocol: " + u.getProtocol());
System.out.println("Host: " + u.getHost());
System.out.println("Port: " + u.getPort());
System.out.println("File: " + u.getFile());
System.out.println("Ref: " + u.getRef());
}
catch (java.net.MalformedURLException ex) {
System.err.println(args[i] + " is not a valid URL");
}
}

}

}
Here's the output:
$ java URLSplitter https://www.poly.edu
Protocol: http
Host: www.poly.edu
Port: -1
File: /
Ref: null


Related Discussions:- Give the example of using a class from the class library

Static variable, import java.text.NumberFormat; import java.util.Locale; p...

import java.text.NumberFormat; import java.util.Locale; public class Client {    // instance data    private String name;    private long income_this_year;    private double perce

Minimum spanning tree based heuristic, Problem description: A travelling s...

Problem description: A travelling salesman wants to make a tour of the cities and returns back to the starting point. What is the minimum length tour? Formal Definiti

Development of an android app urgent, Development of an Android app urgent ...

Development of an Android app urgent Project Description: I am searching for some good android developer who has depth in knowledge of making an app. I am focusing on a certa

Assistance for json authentication problem rss/aol/android, Assistance for ...

Assistance for JSON authentication problem RSS/AOL/Android The key problem we face is how to authenticate afterward the user logged in the webview as well as then parse the JSON

Give the example of using a class from the class library, Give the example ...

Give the example of Using a class from the class library ? You use the java.net.URL class only like you'd use any other class along with these methods in which happens to be n

Define when to use hashmap and when to use treemap, How do you decide when ...

How do you decide when to use HashMap and when to use TreeMap? When we want to perform deletion, insertion and locate elements in a Map then HashMap is used. Whereas TreeMa

java garbage collector? , Each time an object is operated in Java, it goes...

Each time an object is operated in Java, it goes into the area of memory named as heap. The Java heap is named the garbage collectable heap. The garbage collection may not be force

Need professional framework coder with coding experience, Need Professional...

Need Professional Framework Coder with Video Coding Experience? Project Description: Professional Framework Coder with Video Coding experience. You must know API, Java, C++,

State how many arguments were passed using length property, Determine how m...

Determine how many arguments were passed using length property In java, array knows their size by using the length property. By using, length property we can determine how many

Getting code, can i have code on this assignment: The code in the main meth...

can i have code on this assignment: The code in the main method should do the following: 1. Prompt the user for a string input value for the amount in dollars and store it in a va

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd