Core Java interview
- 09 July
java program to check prime number
This is easy question. It may not be asked you directly, but you can use this program to create many other complex program. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Program logic: If any number which is not divisible by any other […]
- 19 June
Difference between Abstract Class and Interface in java
Some of the popular interview questions are “What are differences between abstract class and interface“. “When will you use abstract class and when will you use interface“. So in this article ,we will go through this topic. Before going through differences between them, Lets go through its introduction. Abstract class Abstract classes are created to […]
- 18 June
Comparable in java
In this post, we will see how you can use comparable to sort list of objects in java. Comparable interface: Class whose objects to be sorted must implement this interface.In this,we have to implement compareTo(Object) method. For example: [crayon-67680ce3eac16350630979/] If any class implements comparable inteface then collection of that object can be sorted automatically using […]
- 17 June
Method overloading in java
If two or more methods have same name , but different argument then it is called method overloading. Why you would do that (same name but different argument)? Lets take an example. You want to print salary of employee and sometimes company gives bonus to their employee and sometimes it don’t.So If company don’t give […]
- 17 June
Comparator in java
In this post, we will see how you can use comparator to sort list of objects in java. Comparator: When you want to sort the list of objects of a class,you can use Comparator interface. You don’t need to implement Comparator on the class whose objects need to be sorted. You can create a separate […]
- 17 June
Method overriding in java
If subclass is having same method as base class then it is known as method overriding Or in another words, If subclass provides specific implementation to any method which is present in its one of parents classes then it is known as method overriding Lets start with a real time example: In a small organization,There […]
- 26 February
Externalizable in java
This is 3rd part of java Serialization tutorial Java Serialization Tutorial: Serialization in java Java Serialization interview questions and answers serialversionuid in java serializationexternalizable in java Transient keyword in java Difference between Serializable and Externalizable in Java Before understanding Externalizable interface, you need to have idea about Serialization.You can read more about Serialization at Serialization […]
- 24 February
hashcode() and equals() method in java
In this post ,we will try to understand hashcode() and equals() method in java. Java HashMap: HashMap in java How HashMap works in java hash and indexfor method in HashMap hashcode and equals method in java How to sort HashMap by keys and values Difference between HashMap and HashSet Difference between HashMap and Hashtable How […]
- 11 March
serialVersionUID in java Serialization
This is 2nd part of java Serialization tutorial Java Serialization Tutorial: Serialization in java Java Serialization interview questions and answers serialversionuid in java serialization externalizable in java Transient keyword in java Difference between Serializable and Externalizable in Java serialVersionUID is used to ensure that same class(That was used during Serialization) is loaded during Deserialization.serialVersionUID is […]