Core Java Interview Questions – Set 14

What is URL

?– URL stands for Uniform Resource Locator and it points to resource files on the Internet. URL has four components: http://www. address. com:80/index.html, where http – protocol name, address – IP address or host name, 80 – port number and index.html – file path.

What is the purpose of the Runtime class?

The purpose of the Runtime class is to provide access to the Java runtime system

Which package is always imported by default

The java.lang package is always imported by default.

What is a Jar file

Jar file allows to efficiently deploying a set of classes and their associated resources. The elements in a jar file are compressed, which makes downloading a Jar file much faster than separately downloading several uncompressed files. The package java. util. zip contains classes that read and write jar files

What is the % operator

It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second operand.

What is the difference between the Font and FontMetrics classes

The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of aFont object

How is it possible for two String objects with identical values not to be equal under the == operator?

The == operator compares two objects to determine if they are the same object in memory. It is possible for two String objects to have the same value, but located indifferent areas of memory

What is the ResourceBundle class

The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program’s appearance to the particular locale in which it is being run.

When are static and non static variables of the class initialized

The static variables are initialized when the class is loaded Non static variables

are initialized just before the constructor is called

Is null a keyword?

The null is not a keyword.