Posts

Java Interview Questions - ADP

How to implement composite primary keys in Hibernate? If the database table has more than one column as primary key then we call it as  composite primary key , so if the table has multiple primary key columns , in order to configure these primary key columns in the hibernate mapping file we can configure in 3 ways as below. Using @IdClass annotation @Entity @IdClass(ProjectId.class) public class Project { @Id int departmentId; @Id long projectId; : } Class ProjectId { int departmentId; long projectId; } Using embeddable class: @Entity public class Project { @EmbeddedId ProjectId id; : } @Embeddable Class ProjectId { int departmentId; long projectId; } XML configuration: <hibernate-mapping> <class name = "str.Product" table = "products" > <composite-id> <key-property name = "productId" column = "pid"   /> <key-property name = ...

Java Interview Questions- Phenom People

Technical Round - 01: Constructors Overriding main method Code to check palindrome diff approaches Elasticsearch Performance comparison of db and es Graphite Sql injection Cross site scripting  Code to identify repeated characters in a string Java tuple Best problem solved workwise Identify a deadlock in program JMS point to point messages in java Linq Message queues in java How to get records based on some value in  large data Technical Round - 02: Machine learning Elastic search How do you index 10000 text documents Insert query Difference between match and query_string Shards Diff between java 5 6 7 8 Write your arraylist How to make a class immutable Click here for NTT DATA interview questions

Java Interview Questions - IGATE

Image
What is the difference between Abstract class and Interface ? Is Java support multiple inheritance ? How can we achieve multiple inheritance in Java ?

Java Interview Questions - Pramathi Technologies

Below questions asked in Pramathi Technologies telephonic interview - JAVA 4 years exp: 1.  What is heap dump?  A JVM heap dump is basically a  "snapshot"  of the Java heap memory at a given time.  It is quite different than a JVM thread dump which is a snapshot of the threads.  It is particularly useful when troubleshooting Java heap memory leaks and  java.lang.OutOfMemoryError  problems.  " JVM heap dump generation is an intrusive process which will hang your JVM process until completion " more details...

Java Interview Questions - NTT DATA

Below questions asked in NTT DATA telephonic interview - JAVA 4 years exp: How to make a class as immutable ?  Why String class is immutable ? What is the difference between abstract class and interface ? When to use abstract class and interface ? What is the difference between collections.synchronizedmap and concurrenthashmap ? What is the countdownlatch and cyclicbarrier ? What is the difference between wait() and sleep() ? What happens if an object is serializable but it includes a reference to a non-serializable object? What is synchronization ? What is SQL injection ? How HashMap works internally?

Java Interview Questions - Serialization

Image
1. What is serialization in java ? Object Serialization in Java is a process used to convert Object into a binary format which can be persisted into disk or sent over network to any other running java virtual machine. The reverse process of creating object from binary stream is called deserialization in Java. Java provides Serialization API for serializing and deserializing object which includes java.io.Serializable , java.io.Externalizable , ObjectInputStream and ObjectOutputStream etc.  2. What is the need of Serialization? To send state of one or more object’s state over the network through a socket. To save the state of an object in a file. An object’s state needs to be manipulated as a stream of bytes. 3. Do we need to implement any method of Serializable interface to make an object serializable? No. Serializable is a Marker Interface. It does not have any methods. 4. How would you exclude a field of a class from serialization or what is a tr...

Java Interview Questions - Immutability

1. What is an immutable class? Immutable class is a class which once created, it’s contents can not be changed. Immutable  objects are the objects whose state can not be changed once constructed. e.g. String class 2. How to create an immutable class? To create an immutable class following steps should be followed: Create a final class. Set the values of properties using constructor only. Make the properties of the class final and private Do not provide any setters for these properties. If the instance fields include references to mutable objects, don't allow those objects to be changed: Don't provide methods that modify the mutable objects. Don't share references to the mutable objects. Never store references to external, mutable objects passed to the constructor; if necessary, create copies, and store references to the copies. Similarly, create copies of your internal mutable objects when necessary to avoid returning the originals in your methods. ...