Important Java IQ(Inverview Questions) with answers_Part 3

Q. What is the SimpleTimeZone class?
A. The SimpleTimeZone class provides support for a Gregorian calendar.


Q. What is the difference between a while statement and a do statement?
A. A while statement (pre test) checks at the beginning of a loop to see whether the next loop iteration should occur. A do while statement (post test) checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the loop body at least once.


Q. What is the Locale class?
A. The Locale class is used to tailor a program output to the conventions of a particular geographic, political, or cultural region.


Q. Describe the principles of OOPS.
A. There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation.


Q. Explain the Inheritance principle.
A. Inheritance is the process by which one object acquires the properties of another object. Inheritance allows well-tested procedures to be reused and enables changes to make once and have effect in all relevant places


Q. What is implicit casting?

A. Implicit casting is the process of simply assigning one entity to another without any transformation guidance to the compiler. This type of casting is not permitted in all kinds of transformations and may not work for all scenarios.


Example


int i = 1000;
long j = i; //Implicit casting


Q. Is sizeof a keyword in java?
A. The sizeof operator is not a keyword.


Q. What is a native method?
A. A native method is a method that is implemented in a language other than Java.


Q. In System.out.println(), what is System, out and println?
A. System is a predefined final class, out is a PrintStream object and println is a built-in overloaded method in the out object.


Q. What are Encapsulation, Inheritance and Polymorphism
Or
Q. Explain the Polymorphism principle. Explain the different forms of Polymorphism.
A. Polymorphism in simple terms means one name many forms. Polymorphism enables one entity to be used as a general category for different types of actions. The specific action is determined by the exact nature of the situation.


Polymorphism exists in three distinct forms in Java:
• Method overloading
• Method overriding through inheritance
• Method overriding through the Java interface


Q. What is explicit casting?
A. Explicit casting in the process in which the complier are specifically informed to about transforming the object.


Example


long i = 700.20;
int j = (int) i; //Explicit casting


Q. What is the Java Virtual Machine (JVM)?
A. The Java Virtual Machine is software that can be ported onto various hardware-based platforms

Comments

Popular Posts