Java: The Platform-Independent Programming Language
In this article, we will learn about Java’s platform independence and how Java achieves it.
Introduction
The software programs are very specific to the hardware and operation systems it is written on. When we write a piece of code on a platform, it will compile and run on that sample platform. But for the diversity and portability of the code ...
How To Update A Document in MongoDB Collection in Java Applications?
In this tutorial, we will see how to update a document in MongoDB in Java applications.
To update a document in the MongoDB collection, first, we should have a MongoClient. Let’s see how to create one. Or You can read more at How to Connect to a MongoDB Atlas Cluster in a Java Application
String connectionString = "mongodb+srv://user123:passwo...
Java Program To Remove All Leading and Trailing Whitespaces From The Given String.
In this tutorial, we will see how to remove all the leading and trailing whitespaces from the given String.
Introduction
We can remove all the leading and trailing spaces from the string in two ways,
Using the regex expressions with String.replaceAll()
Using the ready-made String.trim() method
1. Using the regex expressions with String...
How To Find A Document in MongoDB Collection in Java Applications?
In this tutorial, we will see how to find a document in MongoDB in Java applications.
To insert a document in the MongoDB collection, first, we should have a MongoClient. Let’s see how to create one. Or You can read more at How to Connect to a MongoDB Atlas Cluster in a Java Application
String connectionString = "mongodb+srv://user123:password...
How To Insert A Document in MongoDB Collection in Java Applications?
In this tutorial, we will see how to insert a document in MongoDB in Java applications.
To insert a document in the MongoDB collection, first, we should have a MongoClient. Let’s see how to create one. Or You can read more at How to Connect to a MongoDB Atlas Cluster in a Java Application
String connectionString = "mongodb+srv://user123:passwo...
Java Program To Remove All Whitespaces From The Given String.
Remove whitespaces from all over the String
We can replace all whitespaces with empty string using `String.replaceAll() method.
The replace all methods accept regex string and replacement string as input params. And return the replaced string.
We can use the "\\s+" regex expression to find all the whitespaces from the given input string.
Jav...
How to Connect to a MongoDB Atlas Cluster in a Java Application
In this tutorial, we will see how to connect to a MongoDB Atlas cluster ina Java Application.
Your Java application must use the official MongoDB driver to connect to a MongoDB Atlas cluster.
You will add the MongoDB driver as dependency in your maven projects pom.xml file.
<!-- https://mvnrepository.com/artifact/org.mongodb/mongodb-driver...
ArrayList VS LinkedList
In this article, we will see the difference between ArrayList and LinkedList.
ArrayList Vs LinkedList
Property
ArrayList
LinkedList
Internal Implementation
ArrayList internally uses a dynamic array to store the elements.
LinkedList internally uses a doubly linked list to store the el...
99 post articles, 12 pages.