3. Java Libraries. (a) What useful classes are dened in java.util? (b) What usef
ID: 3595366 • Letter: 3
Question
3. Java Libraries.
(a) What useful classes are dened in java.util?
(b) What useful class is dened in java.text?
(c) Where are the following classes dened: Scanner, Math, String, StringBuer, System, NumberFormat, Random, MessageDigest
(d) Where are the following functions dened, and what is the dierence between them? printf(), println()
(e) Where are the following functions dened, and what do they do? What is the dierence? sqrt(), abs(), nextDouble(), append()
(f) What is a “wrapper class”. Name several. Why do we need them?
(g) What are the two classes we use to compute with dates?
Questions from java programming course,Answer for above questions on basis of java libraries.
Explanation / Answer
(a). Classes defined in java.util
1. date and time facilities
2. String tokenizer that is used to split string into tokens
3. random number generator
4. legacy collection classes
(b). The useful classes defined in java.text is:-
Provides classes and interfaces for handling text, numbers, and messages in a manner independent of natural languages.
1. DateFormat
2. AttributedString
3. Format
4. Normalization and many more
(c). Scanner class is defined in java.util.Scanner, Math class is defined in java.lang.Math, String is also defined in java.lang, StringBuffer is defined in java.lang, System is also defined in java.lang package, Random is defined in java.util package, MessageDigest is defined in java.security.MessageDigest.
(d). The printf method of the PrintStream class provides string formatting similar to that in C same is with println and difference is that the cursor jumps to the next line after printing from a println method.
(e). Converts primitive data type to object and vice versa. Names of wrapper classes are:-
Character, Byte, Short, Float, Double, Integer, etc.
As primitive data types do not belong to any class so wrapper classes are used to convert them into objects.
(f). The date class of java.util package is used to commute date. There are several methods in it:
1. set()
2. roll()
3. DategetTime()
4. getMaximum
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.