Infosys Core Java Placement Papers - Infosys Core Java Interview Questions and Answers updated on 19.Mar.2024

Thread is a block of code which can execute concurrently with other threads in the JVM.

It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class.

For eg.,

public class Singleton

{

private static final Singleton s = new Singleton();

private Singleton()

{

}

public static Singleton getInstance()

{

return s;

}

// all non static methods …

}

In order to validate certain expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing.

You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public.

To persist the state of an object into any perminant storage device.

RMI is a remote method invocation. Using RMI, you can work with remote object. The function calls are as though you are invoking a local variable. So it gives you a impression that you are working really with a object that resides within your own JVM though it is somewhere.

LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.

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.

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

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

You can iterator back and forth.

  1. A JDBC-ODBC bridge
  2. A native-API partly Java technology-enabled driver
  3. A net-protocol fully Java technology-enabled driver
  4. A native-protocol fully Java technology-enabled driver For more information.

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

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.

Two different keys with the same hash value. Two different entries will be kept in a single hash bucket to avoid the collision.

An interface with no methods.

Example: Serializable, Remote, Cloneable

It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).

The basic service to manage set of JDBC drivers.

clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString

It is not an instantiable class. It provides the concrete implementation for some/all the methods. So that they can reuse the concrete functionality by inheriting the abstract class.

Using Sytem.getProperty(…) (line.separator, path.separator, …)

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.

hashcode value for this object which is unique for every object.

Abstract class defined with methods. Interface will declare only the methods. Abstract classes are very much useful when there is a some functionality across various classes. Interfaces are well suited for the classes which varies in functionality but with the same method signatures.

It must implement the Cloneable interface