CyberArk Most Frequently Asked Core Java Interview Questions Answers

What Is Aggregation?

It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation.

What Is Composition?

Holding the reference of the other class within some other class is known as composition.

What Is Inner Class?

If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class.

What Is Nested Class?

If all the methods of a inner class is static then it is a nested class.

What Is The Major Difference Between Linkedlist And Arraylist?

LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.
CyberArk Most Frequently Asked Core Java Interview Questions Answers
CyberArk Most Frequently Asked Core Java Interview Questions Answers

What Is The Significance Of Listiterator?


You can iterate back and forth.

What Is The Final Keyword Denotes?

final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more.

What Is Skeleton And Stub? What Is The Purpose Of Those?

Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.

Why Does It Take So Much Time To Access An Applet Having Swing Components The First Time?

Because behind every swing component are many Java objects and resources. This takes time to create them in memory. JDK 1.3 from Sun has some improvements which may lead to faster execution of Swing applications.

What Is The Difference Between Instanceof And Isinstance?

instanceof is used to check to see if an object can be cast into a specified type without throwing a cast class exception. isInstance() Determines if the specified Object is assignment-compatible with the object represented by this Class. This method is the dynamic equivalent of the Java language instanceof operator. The method returns true if the specified Object argument is non-null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise.

What Does The "final" Keyword Mean In Front Of A Variable? A Method? A Class?

FINAL for a variable: value is constant. FINAL for a method: cannot be overridden. FINAL for a class: cannot be derived.

Describe What Happens When An Object Is Created In Java?

Several things happen in a particular order to ensure the object is constructed properly: Memory is allocated from heap to hold all instance variables and implementation-specific data of the object and its superclasses. Implemenation-specific data includes pointers to class and method data. The instance variables of the objects are initialized to their default values. The constructor for the most derived class is invoked. The first thing a constructor does is call the consctructor for its superclasses. This process continues until the constrcutor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java. Before the body of the constructor is executed, all instance variable initializers and initialization blocks are executed. Then the body of the constructor is executed. Thus, the constructor for the base class completes first and constructor for the most derived class completes last.

What Is The Difference Amongst Jvm Spec, Jvm Implementation, Jvm Runtime ?

The JVM spec is the blueprint for the JVM generated and owned by Sun. The JVM implementation is the actual implementation of the spec by a vendor and the JVM runtime is the actual running instance of a JVM implementation.

How Does Java Handle Integer Overflows And Underflows?

It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.

Why Are There No Global Variables In Java?

Global variables are considered bad form for a variety of reasons: Adding state variables breaks referential transparency (you no longer can understand a statement or expression on its own: you need to understand it in the context of the settings of the global variables), State variables lessen the cohesion of a program: you need to know more to understand how something works. A major point of Object-Oriented programming is to break up global state into more easily understood collections of local state, When you add one variable, you limit the use of your program to one instance. What you thought was global, someone else might think of as local: they may want to run two copies of your program at once. For these reasons, Java decided to ban global variables.

Whats The Difference Between Notify() And Notifyall()?

notify() is used to unblock one waiting thread; notifyAll() is used to unblock all of them. Using notify() is preferable (for efficiency) when only one blocked thread can benefit from the change (for example, when freeing a buffer back into a pool). notifyAll() is necessary (for correctness) if multiple threads should resume (for example, when releasing a “writer” lock on a file might permit all “readers” to resume).

How Can My Application Get To Know When A Httpsession Is Removed?

Define a Class HttpSessionNotifier which implements HttpSessionBindingListener and implement the functionality what you need in valueUnbound() method. Create an instance of that class and put that instance in HttpSession.

What Interface Must An Object Implement Before It Can Be Written To A Stream As An Object?

An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.

What Is Your Platform's Default Character Encoding?

If you are running Java on English Windows platforms, it is probably Cp1252. If you are running Java on English Solaris platforms, it is most likely 8859_1.

Post a Comment

Previous Post Next Post