Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
5 Projects You can do to learn TensorFlow in 2024 - Best of Lot
8 Best Programming Languages You Can Learn in 2024 for Better Pay and Jobs
Top 10 Open Source Frameworks & Libraries for Java Web Developers for 2024 [UPDATED]
5 Things You Can Gift to Programmers, Software Developers, and Tech Geeks in 2024
10 Projects You can Build to Learn Golang in 2024
Visitor Design Patterns In Java Examples Tutorial
Hello guys, if you want to learn Visitor design pattern in Java then you have come to the right place. Earlier, I have covered many design patterns like Decorator, Strategy, State, Composite, Adapter, Command, Template, Factory, Observer and even few Microservice patterns like SAGA and Database per service and in this article, I will talk about Visitor Design Pattern and how to implement in Java. You will learn things like what is Visitor design pattern, what problem it solves, what are pros and cons of Visitor design pattern, when to use Visitor pattern as well as any alternatives of Visitor Pattern in Java. I will also show you a real world example of Visitor design pattern, but, before we get to the 5 best examples that will teach you all about design patterns in Java, let me tell you a little bit more about what it really is.
Difference between 32-bit vs 64-bit JVM in Java?
How to remove duplicate(s) from linked list in Java? Example Tutorial
10 Examples Of Mockito + JUnit in Java for Unit Testing
How to convert Java 8 Stream to Array and ArrayList in Java? Example Tutorial
Array length vs ArrayList Size in Java [Example]
How to create an ArrayList from Array in Java? Arrays.asList() Example Tutorial
One of the common problems faced by junior and less experienced Java developers is converting an array to ArrayList e.g. they are getting an array from somewhere in their code and then want to create an ArrayList out of that so that they can add more elements and use other library methods which operate with ArrayList or List. The simplest way to convert an array to ArrayList is by using the Arrays.asList() method, which acts as a bridge between Collection classes and array data structure. This method returns a List that contains elements from an array.
How to check If two Strings Array are equal in Java? Example Tutorial
How to find Factorial in Java using Recursion and Iteration - Example Tutorial
Is it Possible to add static or private methods in Java interface?
What is Diamond operator in Java? Example Tutorial
Hello guys, if you are reading Java code and come across closed angle bracket with a diamond like shape and wondering what they are and what they do then you have come to the right place. They are known as Diamond operator in Java and I will explain you what they are and where should you use them in this article. The Diamond operator is a relatively new operator in Java which was first introduced in JDK 7 to improve type inference and reduce boilerplate Java coding. It is denoted with a closed angle bracket that resembles the shape of a diamond (<>) and that's why it's called the Diamond operator. If used correctly it can reduce typing and boilerplate coding in Java and result in much cleaner and readable code especially when you use Generics.
Parallel Array Sorting in Java - Arrays.parallelSort() Example
Difference between Thread vs Process in Java? Example
Difference between yield and wait method in Java? Answer
10 points about wait(), notify() and notifyAll() in Java Thread?
How to run Threads in an Order in Java - Thread.Join() Example
10 Examples Of Lombok Libarary In Java
10 Examples Of Ternary Operator In Java
Hello guys, if you are wondering how to use ternary operator in Java then you have come to the right place. Ternary operator is a great operator and you can use ternary operator to replace a simple if-else statement. Since ternary operator allows you to write code in one line, its much more succinct and readable and that's what many Java developer love it, including me. In the last article, I shared 10 example of XOR bitwise operator in Java and in this article, I am going to share 10 example of ternary operator in Java so that you not only know what is ternary operator but also you can use it effectively to write better Java code. But, before we get to the 10 best examples that will teach you everything there is to know about ternary operators in Java, let me tell you a little bit more about what it all really is.
Top 35 Java String Interview Questions with Answers for 2 to 5 Years Experienced Programmers
How to convert float, double, String, Map, List to Set, Integer, Date in Java - Example Tutorial
Spring HelloWorld Example in Java Annotations and Autowiring [Tutorial]
Top 50 Java Collections + Generics Interview Questions and Answers for 1 to 3 Years Experienced
Difference between HashMap vs IdentityHashMap in Java? Example
How to set the logging level in Spring Boot application.properties - Example Tutorial
Hello guys, if you are wondering how to set the logging level on spring boot then you have come to the right place. In the past, I have shared the best Spring Boot courses and free courses to learn Spring MVC and in this article, I will share how to set logging levels like DEBUG and INFO in Spring Boot. How do we configure the logging level of our Spring boot application is one of the questions that arise when developing a large application. Because we need to trace errors, warnings, informational data when running our application and to this, Spring has introduced Spring boot logging configurations.
How to use @ResponseBody and @RequestBody in Spring MVC and REST? Example Tutorial
Difference between Binary Tree, Binary Search Tree (BST), and Balanced Tree (AVL and Red Black Tree)?
Top 50 Core Java Interview Questions and Answers for Beginners
Top 20 Linux and SQL Interview Questions for Java and IT Professionals
How to Synchronize HashMap in Java? Collections.synchronizedMap() Example Tutorial
Difference between WeakHashMap , IdentityHashMap, and EnumMap in Java?
Java HashMap keySet() , entrySet and values() Example - Tutorial
What is static and instance Method in Java? Example Tutorial
How to use Lambda Expression and method reference in Java? Example Tutorial
Composite Design Pattern Example in Java and Object Oriented Programming
Hello guys, if you are wondering how to use Composite design pattern in Java then you are at the right place. Composite design pattern is another object oriented design pattern introduced by Gang of Four in there timeless classic book Design pattern : Elements of Reusable software. Composite pattern as name suggest is used to compose similar things together, like similar objects. It implements an interface and also contains other objects which implements the same interface, also known as containee. One of the best example of Composite pattern from Java standard library is Swing's container classes e.g. Panel, which not only are Components by themselves, but also contains other components like JButton, Label, JTable etc.
6 Advanced Comparator and Comparable Examples in Java 8
How to convert String to long in Java? Example
How to convert String to Double in Java and double to String with Example
How to check if two String variables are same in Java? equals(), equalsIgnoreCase() and == operator Example
How to Read User Input and Password in Java from command line? Console Example
How to replace characters and substring in Java? String.replace(), replaceAll() and replaceFirst() Example
Difference between StringBuilder and StringBuffer in Java with Example
How to check if a Number is Power of Two in Java? [Bitwise AND Example]
5 Difference between Hashtable vs HashMap in Java? Answer
Hashtable and HashMap are two hash-based collections in Java and are used to store objects as key-value pairs. Despite being hash-based and similar in functionality there is a significant difference between Hashtable and HashMap and without understanding those differences if you use Hashtable in place of HashMap then you may run into series of subtle programs which is hard to find and debug. Unlike the Difference between ArrayList and HashMap, Differences between Hashtable and HashMap are more subtle because both are similar kinds of collections. Before seeing the difference between HashMap and Hashtable let's see some common things between HashMap and Hashtable in Java.
How to write a Parameterized Method in Java using Generics? Example
Difference between Static and Dynamic binding in Java
Difference between Polymorphism vs Inheritance in Java and Object Oriented Programming - Example
How to convert ArrayList to Comma Separated or Delimited String in Java - Spring Example
Difference between JDK and JRE in Java Platform
Difference between this and super keywords in Java
How to use String literals in switch case in Java? Example Tutorial
10 Example of SSH Command in UNIX and Linux
How to Fix java.lang.ArrayIndexOutOfBoundsException in Java [Solution]
10 Reasons of java.lang.NumberFormatException in Java - Solution
3 ways to solve Eclipse - main class not found error
Can You declare Constructor inside Servlet Class in Java? Answer
10 Examples of ps command in Linux
In Today's article, You will be learning about the "ps" command in Linux and our objectives are:
To know what Ps stands for, how it works with numerous options, and provide different examples and the usage of it.
PS stands for processes status. Basically used to list the processes that are running at the moment. As we all know that when a task needs to be implemented it must follow or have a process. There are different options you could use with it and this gives you a different result.
How to fix "variable might not have been initialized" error in Java? Example
[Solved] Error: could not open 'C:\Java\jre8\lib\amd64\jvm.cfg'
Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger in Java [Solution]
Cause : Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger error indicates that JVM is not able to found org.apache.log4j.Logger class in your application's CLASSPATH. The simplest reason for this error is the missing log4j.jar file. Since org.apache.log4j.Logger class belongs to this JAR file, if it's not available at run-time then your program will fail.
How to Avoid/Fix ConcurrentModificationException while looping over ArrayList in Java [Example]
java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject [Solved]
'javac' is not recognized as an internal or external command [Solution]
How to Fix java.lang.OufOfMemoryError: Direct Buffer Memory
java.lang.OutOfMemoryError: Java heap space : Cause and Solution
How to fix "class, interface, or enum expected" error in Java? Example
How to fix "illegal start of expression" error in Java? Example
[Solved] java.lang.unsupportedclassversionerror Unsupported major.minor version 55.0, 57.0, 60.0, 61.0 Error in Java? Examples
Difference between Correlated Subquery vs Non-Correlated (Self Contained) subquery in SQL - Example
Difference between ISNULL() and COALESCE() function in SQL? Example
Difference between table scan, index scan, and index seek in SQL Server Database? Example
How to find Nth Highest Salary in MySQL and SQL Server? Example LeetCode Solution
---------------------------------------------------------------
Write a SQL query to get the nth highest salary from the Employee table.
+----+--------+
| Id | Salary |
+----+--------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
+----+--------+
For example, given the above Employee table, the nth highest salary where n = 2 is 200. If there is no nth highest salary, then the query should return null.