Java

Java Lock Example - ReentrantLock — step-by-step Programming tutorial on Progressive Robot

Java Lock Example – ReentrantLock

URL: https://www.progressiverobot.com/java-lock-example-reentrantlock/ Welcome to Java Lock example tutorial. Usually when working with multi-threaded environment, we use [synchronized for thread safety](/community/tutorials/thread-safety-in-java). Java Lock ![java lock, java lock example, ReentrantLock in Java, java locks](images/java-lock-example-reentrantlock-section-1.png) Most of the times, synchronized keyword is the way to go but it has some shortcomings that lead the way to inclusion of […]

Read more
How to Remove Array Elements in Java — step-by-step Programming tutorial on Progressive Robot

How to Remove Array Elements in Java

URL: https://www.progressiverobot.com/java-remove-array-elements/ Introduction In Java, arrays are a fundamental data structure that allows us to store a collection of elements of the same data type. When we declare an array, we specify its data type and size, which is used by the Java Virtual Machine (JVM) to allocate the necessary memory for the array elements. […]

Read more
Java String Interview Questions and Answers — step-by-step Programming tutorial on Progressive Robot

Java String Interview Questions and Answers

URL: https://www.progressiverobot.com/java-string-interview-questions-and-answers/ Introduction String is one of the most widely used Java classes. This article provides some practice questions and answers about String to help you prepare for an interview. You can also try the [Java String Quiz](/community/tutorials/java-string-quiz) to test your knowledge of the String class. What is the String class in Java? Is String […]

Read more
java.util.ConcurrentModificationException — step-by-step Programming tutorial on Progressive Robot

java.util.ConcurrentModificationException

Java Collection classes are fail-fast which means that if the Collection will be changed while some thread is traversing over it using iterator, the iterator.next() will throw ConcurrentModificationException. This situation can come in case of multithreaded as well as single threaded environment.

Read more
json-simple example — step-by-step Programming tutorial on Progressive Robot

json-simple example

URL: https://www.progressiverobot.com/json-simple-example/ json-simple is a simple java toolkit for JSON. json-simple library is fully compliance with JSON specification (RFC4627). json-simple ![json-simple, json simple example, json example](images/json-simple-example-section-1.png) json-simple uses [Map](/community/tutorials/java-map) and [List](/community/tutorials/java-list) internally for JSON processing. We can use json-simple for parsing JSON data as well as writing JSON to file. One of the best feature […]

Read more
Matrix Programs in Java — step-by-step Programming tutorial on Progressive Robot

Matrix Programs in Java

URL: https://www.progressiverobot.com/matrix-programs-in-java/ A Matrix is a rectangular array. The elements are arranged in the rows and columns. In this tutorial, we will look at some matrix programs in Java. Graphical Representation of Matrix Matrix in Java We can implement a matrix using [two dimensional array in Java](/community/tutorials/two-dimensional-array-java). The element at row "r" and column "c" […]

Read more
OpenCSV CSVReader CSVWriter Example — step-by-step Programming tutorial on Progressive Robot

OpenCSV CSVReader CSVWriter Example

URL: https://www.progressiverobot.com/opencsv-csvreader-csvwriter-example/ OpenCSV is a lightweight java CSV parser. Today we will look into OpenCSV example for CSV parsing. OpenCSV ![OpenCSV, CSVReader, CSVWriter, OpenCSV Example](images/opencsv-csvreader-csvwriter-example-section-1.png) OpenCSV provides most of the basic features for CSV parsing. OpenCSV is more popular because we don't have any builtin CSV parser in java. Some of the important classes in […]

Read more
Servlet Exception and Error Handling Example Tutorial — step-by-step Programming tutorial on Progressive Robot

Servlet Exception and Error Handling Example Tutorial

URL: https://www.progressiverobot.com/servlet-exception-and-error-handling-example-tutorial/ Today we will look into Servlet Exception and Error Handling. Sometime back I wrote a post about [Exception Handling in Java](/community/tutorials/exception-handling-in-java) but when it comes to web application, we need more than normal exception handling in java. Servlet Exception If you notice, doGet() and doPost() methods throw javax.servlet.ServletException and IOException, let's see what […]

Read more
Why String is Immutable in Java? — step-by-step Programming tutorial on Progressive Robot

Why String is Immutable in Java?

URL: https://www.progressiverobot.com/string-immutable-final-java/ Why String is immutable in Java is one of the popular interview questions. The string is one of the most used classes in any programming language. We know that String is immutable and final in Java. Java runtime maintains a [String pool](/community/tutorials/what-is-java-string-pool) that makes it a special class. Why String is immutable in […]

Read more
What is Java String Pool? — step-by-step Programming tutorial on Progressive Robot

What is Java String Pool?

URL: https://www.progressiverobot.com/what-is-java-string-pool/ As the name suggests, String Pool in java is a pool of Strings stored in [Java Heap Memory](/community/tutorials/java-heap-space-vs-stack-memory "Java Heap Memory vs Stack Memory Difference"). We know that String is a special class in java and we can create String objects using a new operator as well as providing values in double-quotes. String […]

Read more
CHAT