Accessing standard library classes in java Assignment Help

Assignment Help: >> Java libraries >> Accessing standard library classes in java

Accessing standard library classes in java:

Table shows the most important of the standard Java packages dealt with in this course. In this section we discuss how we can gain access to the classes de?ned in those packages, and in the next section we shall discuss how to ?nd out more details of the classes in each package.

2051_accessing standard library.png

Each package contains a number of classes that the language designers knew would be useful in the intended application areas for Java. For example, the java.net package has a URL class that manipulates uniform resource locators (such as web page addresses). The fully quali?ed name of this class is its package name, java.net, followed by the separator (a dot), followed by the class name, URL, like this:

java.net.URL

To use this class in your program, you can refer to it by its fully quali?ed name. For example:

java.net.URL homeURL =
new java.net.URL("https://www.open.ac.uk");

This is obviously rather long-winded and a better approach is to write an import declaration near the start of your source ?le. You can then refer to the class by its simple name, URL, as follows:

...
import java.net.URL;
...
URL homeURL = new URL("https://www.open.ac.uk");

Note the compulsory semicolon terminating the import declaration. If you require other library classes, then separate import statements are needed. For example, if you require both the URL class and the ArrayList class from the java.util package then you should write:

import java.net.URL;
import java.util.ArrayList;

The import declaration informs the Java system which package to look in for details of any class it does not recognize from your source ?les alone. If you omit any necessary import statements, the compiler will indicate an error.

If you require a number of classes within the same package then it is normally more convenient to use the import-on-demand facility, with a wild card instead of a speci?c class name, like the following:

import java.util.*;

This declaration allows the programmer to use any of the public items (mainly classes) contained in the java.util package. Using a wild card import declaration will not make your program any larger or slower than importing individual classes by name. Your compiled program will include only details of the classes you actually use, which is why this is referred to as import-on-demand.

 

Java Assignment Help - Java Homework Help

Struggling with java programming language? Are you not finding solution for your Accessing standard library classes in java homework and assignments? Live Accessing standard library classes in java experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer Accessing standard library classes in java homework help, java assignment help and Accessing standard library classes in java projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.

Why Expertsmind for assignment help

  1. Higher degree holder and experienced experts network
  2. Punctuality and responsibility of work
  3. Quality solution with 100% plagiarism free answers
  4. Time on Delivery
  5. Privacy of information and details
  6. Excellence in solving java programming language queries in excels and word format.
  7. Best tutoring assistance 24x7 hours

 

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