NetApp Most Frequently Asked Core Java Interview Questions Answers

What Is A Static Method?

A static method is a method that belongs to the class rather than any object of the class and doesn't apply to an object or even require that any objects of the class have been instantiated.

What Is The Difference Between A Window And A Frame?

A frame is a resizable, movable window with title bar and close button. Usually it contains Panels. Its derived from a window and has a borderlayout by default.

A window is a Container and has BorderLayout by default. A window must have a parent Frame mentioned in the constructor.

What Are Peerless Components?

The peerless components are called light weight components.

What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?

The Reader/Writer class hierarchy is character-oriented and the InputStream/OutputStream class hierarchy is byte-oriented.
NetApp Most Frequently Asked Core Java Interview Questions Answers
NetApp Most Frequently Asked Core Java Interview Questions Answers

What Is The Difference Between Throw And Throws Keywords?

The throw keyword denotes a statement that causes an exception to be initiated. It takes the Exception object to be thrown as argument. The exception will be caught by an immediately encompassing try-catch construction or propagated further up the calling hierarchy. The throws keyword is a modifier of a method that designates that exceptions may come out of the method, either by virtue of the method throwing the exception itself or because it fails to catch such exceptions that a method it calls may throw.

Name Primitive Java Types?

The primitive Java types are byte, char, short, int, long, float, double and boolean.

How Can A Gui Component Handle Its Own Events?

A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.

What Advantage Do Java's Layout Managers Provide Over Traditional Windowing Systems?

Java uses layout managers to layout components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.

What Are The Problems Faced By Java Programmers Who Don't Use Layout Managers?

Without layout managers, Java programmers are faced with determining how their GUI will be displayed across multiple windowing systems and finding a common sizing and positioning that will work within the constraints imposed by each windowing system.

What Is The Difference Between Static And Non-static Variables?

A static variable is associated with the class as a whole, rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

What Is The Difference Between The Paint() And Repaint() Methods?

The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.

What Is A Container In A Gui?

A Container contains and arranges other components (including other containers) through the use of layout managers, which use specific layout policies to determine where components should go as a function of the size of the container.

Is Iterator A Class Or Interface? What Is Its Use?

Iterator is an interface which is used to step through the elements of a Collection.

How You Can Force The Garbage Collection?

Garbage collection is an automatic process and can't be forced.

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.

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.

Post a Comment

Previous Post Next Post