All the classes in java.lang package are automatically imported when a program is compiled.

a)True
b)False
Ans:a.

How can class be imported to a program?

Ans: To import a class, the import keyword should be used as shown.; import classname;

How can class be imported from a package to a program?

Ans: import java . packagename . classname (or) import java.package name.*;

What is a constructor?

Ans: A constructor is a special kind of method that determines how an object is initialized when created.

Which keyword is used to create an instance of a class?

Ans: new.

Which method is used to garbage collect an object?

Ans: finalize ().

Constructors can be overloaded like regular methods.

a)True
b)False
Ans:a.

What is casting?

Ans: Casting is bused to convert the value of one type to another.

Casting between primitive types allows conversion of one primitive type to another.

a)True
b)False
Ans:a.

Casting occurs commonly between numeric types

a)True
b)False
Ans:a.

Boolean values can be cast into any other primitive type.

a)True
b)False
Ans:b.

Casting does not affect the original object or value.

a)True
b)False
Ans:a.

Which cast must be used to convert a larger value into a smaller one?

Ans: Explicit cast.

Which cast must be used to cast an object to another class?

Ans: Specific cast.

Which of the following features are common to both Java & C++?

A.The class declaration
b.The access modifiers
c.The encapsulation of data & methods with in objects
d.The use of pointers
Ans:a,b,c.

Google