October 15, 2018

Srikaanth

eClerx Most Frequently Asked Core Java Interview Questions Answers

Describe The Principles Of Oops?

There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation.

Explain The Encapsulation Principle?

Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by the other code defined outside the wrapper.

Explain The Inheritance Principle?

Inheritance is the process by which one object acquires the properties of another object.

How To Define An Abstract Class?

A class containing abstract method is called Abstract class. An Abstract class can't be instantiated.
Example of Abstract class: abstract

class testAbstractClass {
protected String myString;
public String getMyString() { return myString;
}
public abstract string anyAbstractFunction{);
}

How To Define An Interface?

In Java, Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
Example of Interface

public interface samplelnterface {
public void functionOne();
public long CONSTANTJDNE = 1000;
}

Explain The Polymorphism Principle?

The meaning of Polymorphism is something like 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. The concept of polymorphism can be explained as "one interface, multiple methods".

Explain The Different Forms Of Polymorphism?

From a practical programming viewpoint, polymorphism exists in three distinct forms in Java

Method overloading
Method overriding through inheritance
Method overriding through the Java interface.
eClerx Most Frequently Asked Core Java Interview Questions Answers
eClerx Most Frequently Asked Core Java Interview Questions Answers

What Are Access Specifiers Available In Java?

Access specifiers are keywords that determine the type of access to the member of a class. These are

Public
Protected
Private
Defaults.

What Do You Understand By A Variable?

The variables play a very important role in computer programming. Variables enable programmers to write flexible programs. It is a memory location that has been named so that it can be easily be referred to in the program. The variable is used to hold the data and it can be changed during the course of the execution of the program.

What Do You Understand By Numeric Promotion?

The Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place. In the numerical promotion process the byte, char and short values are converted to int values. The int values are also converted to long values, if necessary the long and float values are converted to double values, as required.

Differentiate Between A Class And An Object.

A Class is only the definition or prototype of real life object. Whereas an object is an instance or living representation of real life object. Every object belongs to a class and every class contains one or more related objects.

What Is The Use Of Object And Class Classes?

The Object class is the superclass of all other classes and it is highest-level class in the Java class hierarchy. Instances of the class Class represent classes and interfaces in a running Java application. Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions. The primitive Java types (boolean, byte, char, short, int, long, float and double) and the keyword void are also represented as Class objects.

What Do You Understand By Casting In Java Language?

The process of converting one datatype to another in Java language is called Casting.

What Are The Types Of Casting?

There are two types of casting in Java, these are Implicit casting and Explicit casting.

What Do You Understand By Downcasting?

The process of Downcasting refers to the casting from a general to a more specific type, i.e; casting down the hierarchy.

What Do You Understand By Final Value?

FINAL for a variable: value is constant.

FINAL for a method: cannot be overridden.

FINAL for a class: cannot be derived.

What Are Keyboard Events?

When Java generates a keyboard event, it passes an Event object that contains information about the key pressed, Java recognizes normal keys, modifier keys, and special keys, For normal keys, the event object contains the key's ASCII value. For the function, arrow and other special keys, there are no ASCII codes, so Java uses special Java-defined code. You have learned how to detect modifier keys. The modifier keys are stored in the modifiers variable in the Event object.

What Is The Intersection And Union Methods?

When your program uses Rectangle objects, you may need to determine the screen region that holds both objects or two Rectangle objects intersect, to find the intersection or the union of two rectangles, you can use the Rectangle class intersection and union methods. The intersection method returns the area where two Rectangle objects overlap. That is, the intersecting method return the area that two Rectangle objects have in common.

The union method, on the other hand, behaves differently than you might expect. The union method returns the smallest rectangle that encloses two Rectangle objects, instead of returning just the area covered by both objects. This illustrates the behavior of the intersection and union methods.

What Are Controls And Their Different Types In Awt?

Controls are components that allow a user to interact with your application and the AWT supports the following types of controls

Labels, Push Buttons, Check Boxes, Choice Lists, Lists, Scrollbars, Text Components.

These controls are the subclasses of the Component.

What Is The Difference Between Choice And List?

A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices and only one item may be selected from a choice. A List may be displayed in such a way that several list items are visible and it supports the selection of one or more list items.

What Is The Difference Between Scrollbar And Scrollpane?

A Scrollbar is a Component, but not a Container whereas Scrollpane is a Container and handles its own events and perform its own scrolling.

Which Containers Use A Flow Layout As Their Default Layout?

Panel and Applet classes use the FlowLayout as their default layout.

What Are Wrapper Classes?

Wrapper classes are classes that allow primitive types to be accessed as objects.

https://mytecbooks.blogspot.com/2018/10/eclerx-most-frequently-asked-core-java.html
Subscribe to get more Posts :