Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
How to Implement Double Checked Locking Singleton Pattern in Java? Example Tutorial
Java Serialization Example and Tutorial for Beginners [Guide]
7 Difference between extends Thread vs implements Runnable in Java [Answer]
Difference between View and Materialized View in Database or SQL? [Answer]
How to find symbolic link or soft link in Linux? ls + find command Example Tutorial
10 Examples of forEach() method in Java 8
How to pause a Thread in Java? Thread.sleep and TimeUnit.sleep Example
10 Examples of ALTER Table Command in SQL
5 Difference between Interface and Abstract class in Java? [Answer]
The difference between abstract class and interface in Java is one of the tricky Java interview questions and mostly appears in core Java interviews. It has become now even trickier after Java 8 introduced default methods and allowed interfaces to have both default and static methods. Even though both interface and abstract class are a way to achieve abstraction in Java, there are significant differences between them, which you will learn in this article. Some time interviewer also not just focuses on key differences between abstract class and interface in Java but he is also interested in some practical experience e.g. when to use interface in Java and when to use an abstract class in Java.
Top 100 Angular Interview Questions for 1 to 2 Years Experienced Developers
OCMJEA 6 FAQs - Oracle Certified Master - Java EE 6 Enterprise Architect (1Z0-807, 1Z0-865 and 1Z0-866) - Frequently asked Questions
Java 8 Stream + FlatMap Example for Beginners | How to flat a list of list in Java?
How to get and set Value of a text field using jQuery? Example Tutorial
23 Design Patterns Java Developers Should know
1. Abstract Factory Design Pattern
Abstract Factory is a creational Design Pattern, which is used to control the creation of Objects.
2. Adapter design pattern
The Adapter is a structural design pattern; it is used to maintain the structure of classes in object-oriented programs like Java applications.
3. Bridge Design Pattern
The bridge is also a structural design pattern
4. Builder Design Pattern
The Builder is another creational design pattern in Java.
5. Chain of Responsibility Pattern
Chain of Responsibility is a behavioral pattern from Gang of Four. It avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. You actually have a chain of receiving objects, starting from lower level to higher level, request move along the chain until an object handles it.
6. Command Design Pattern
The Command Pattern is also a behavioral design pattern and uses to control the behavior of an object or set of objects in a program. The command object is used to encapsulate a request, thus allows you to parameterize clients with different requests, queue, or log requests, and also support undo sort of functionality. As the name suggests, it is used to execute commands e.g., buttons on the remote control.
7. Composite Design Pattern
Composite pattern is another structural design pattern
8. Decorator Design Pattern
Decorator is also a structural pattern
9. Facade Design Pattern
The Facade is another structure design pattern for Java developers.
10. Factory Method Design Pattern
Like Abstract Factory, this is also a creational design pattern, provides a better way to create an instance of objects in Java or any other object-oriented programming language.
11. Flyweight Design Pattern
It's a structural pattern
12. Interpreter Design Pattern
13. Iterator Design Pattern
14. Mediator Design Pattern
15. Memento Design Pattern
16. Prototype Design Pattern
17. Proxy Design Pattern
18. Observer Design Pattern
19. Singleton Design Pattern
20. State Design Pattern
21. Strategy Design Pattern
22. Template Method Design Pattern
23. Visitor Design Pattern
And here is the big diagram which shows the relationship among different object-oriented design patterns:

That's all on this list of object-oriented design Patterns, Java developers should know. In fact, this list of patterns is equally useful for any object-oriented programmer working on object-oriented languages like C++, Scala, or any other language.
These are also known as Gang Of Four (GOF) design pattern because it was first published in the GOF design pattern book. Just keep one thing in mind, design patterns are tried and tested solutions to some particular problem, but it doesn't mean you always need them.
In fact, if you are familiar with these patterns and know their intent and when to use them, you will automatically alert by your mind about places where you can use these patterns.
I always keep these patterns back of my mind, and while coding, I somehow know that, Ok, this is the place where I should use this pattern. I never use them pre-planned; in fact, they came at random while doing coding, testing, refactoring, and code review.
3 ways to sort a List in Java 8 and 11 - Example Tutorial
There are multiple ways to sort a list in Java 8, for example, you can get a stream from the List and then use the sorted() method of Stream class to sort a list like ArrayList, LinkedList, or Vector and then convert back it to List. Alternatively, you can use the Collections.sort() method to sort the list. There is also a sort() method added to the List class itself. The Collections.sort() method is an older one and it's available from JDK 1.0 itself but List.sort() is a new method added in Java 8. This method accepts a Comparator if you want to sort a List in a custom order, otherwise, you can pass null if you want to sort a List on the natural order of their elements.
How to use Spread operator and Rest parameter in JavaScript? Example Tutorial
Hello guys, if you are wondering what is Spread and Rest operator is in JavaScript are and how to use them in code then you have come to the right place. Earlier, I have shared some fundamental JavaScript concept tutorials like == vs === operator, hoisting, and destructuring, and in this JavaScirpt article, I am going to talk about Spread and Rest operators. JavaScript came out twenty-five years ago. Since then, it has changed a lot. First, it became the top programming language for client-side web development, and then with the emergence of Node.js, it also became the top player in server-side development.
What is Variable and Function Hoisting in JavaScript? Example Tutorial
Hoisting is a complex concept in JavaScript. Like other major programming languages, variables and functions are an important part of JavaScript. Being a dynamically typed programming language, the variable declaration does not require specifying variable types. JavaScript also supports functions. But there is a catch. When variables and functions are declared in JavaScript, a process called hoisting takes place, and if you don't know this important concept you may struggle reading and understanding code but don't worry. In this article, I will teach you what is hoisting in JavaScript and give you real-world examples of the function and variable hoisting to start with.
What is Destructuring in JavaScript? Example Tutorial
Arrays and objects play a very important role in programming. Every major programming language supports arrays and objects. Both arrays and objects are used to store data. The concept is simple but very powerful. JavaScript also supports arrays and objects. In fact, they are a very important part of modern JavaScript development. It does not matter if you are working on the frontend or backend, you are going to use arrays and objects. Over time, more and more features were added in JavaScript to make it easy to work with arrays and objects.
Difference between first level and second level cache in Hibernate
Difference between IN, OUT, and INOUT parameters in JDBC Stored Procedure? Answer
Hello guys, Java Database Connectivity, the JDBC API supports three types of parameters, I mean, IN, OUT, and INOUT. They are used to bind values into SQL statements. An IN parameter is the one whose value is unknown when the SQL statement is created and you bind values using various setXXX() method depending upon the type of column those IN parameter refers in SQL query. For example in SQL query, SELECT * from EMPLOYEE where EMP_ID=? if the EMP_ID is a VARCHAR column then you must call the setString() method to pass the value to the IN parameter.