|
Page 3 of 14
The toArray() method present in the List, Set, and Collection
interfaces is used to return an array containing all the elements in
the list and set respectively. In case of the List interface, the
elements are arranged in a proper sequence. The syntaxes of the
toArray() method are as follows:......[read more]
Coupling is a term that describes the degree to which one module relies
on another module for its proper functioning. Coupling is mainly of the
following two types: Loose coupling : Loose or weak coupling implies
that a change in one module does not require changes in the
implementation of......[read more]
Cohesion is a measure of degree of how strongly a class focusses on its
responsibilities. It is of the following two types: High cohesion: This
means that a class is designed to carry on a specific and precise task.
Using high cohesion, methods are easier to understand, as they perform
a......[read more]
The Comparator interface is used to sort collections and arrays. It
differs from the Comparable interface in that the Comparable interface
sorts the elements only in the natural order. In contrast, the
Comparator interface sorts the collections and arrays in a number of
different ways. The......[read more]
The PriorityQueue class extends the AbstractQueue class and implements
the Queue interface. The Queue interface normally stores elements in
the first-in-first-out order. A PriorityQueue stores elements either in
the natural order or in the order specified by a comparator. The
important......[read more]
The Date class encapsulates the current date and time in terms of
milliseconds. Most of the methods in the Date class have been
deprecated. This class is mainly used as a bridge between the Calendar
class and the DateFormat class. The constructors defined in the Date
class are as follows:......[read more]
An IllegalStateException is a kind of runtime exception. It is used to
indicate that a method has been invoked on an object that is not in an
appropriate state to perform the requested operation. This means that
the method has been invoked at an inappropriate time. Following
constructors are......[read more]
The printf() method is used to output a formatted string to the
console. This method automatically uses the Formatter to create a
formatted string. The printf() method is very similar to the format()
method present in the Formatter class. This method is present in both
the PrintWriter and......[read more]
The Calendar class is abstract and provides methods to convert the time
in milliseconds to the calendar fields such as seconds, minutes, hours,
days, weeks, months, and years. It makes the manipulation of dates
easy. The Calendar class does not provide any public constructor. It
is......[read more]
NumberFormat is an abstract class that is used to format numbers and
currency values. This class extends the java.util.Format class. The
important methods of the NumberFormat class are as follows: static
final NumberFormat getInstance() : This method returns the default
number format for......[read more]
|