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.
SOFTWARE COMPANIES
RESUME PREPRATION
INTERVIEW TIPS
C QUESTIONS
chapter 1
chapter 2
chapter 3
chapter 4
chapter 5
chapter 6
chapter 7
chapter 8
chapter 9
chapter 10
View All
DATA STRUCTURE
TECHNICAL QUESTIONS
JAVA
First chapter
Second chapter
Third chapter
Fourth chapter
Fifth chapter
Sixth chapter
Seventh chapter
Eight chapter
ninth chapter
Tenth chapter
eleventh chapter
Twevelth chapter
View All
FILE EXTENSION