AmitDiwan has Published 10744 Articles

Java program to check if a string is empty or null

AmitDiwan

AmitDiwan

Updated on 08-Nov-2024 22:31:26

991 Views

In this article, we will understand how to check if a string is empty or null in Java. The string is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). We’ll start by learning to detect these cases directly within the main method, and ... Read More

Java program to print unique values from a list

AmitDiwan

AmitDiwan

Updated on 08-Nov-2024 22:30:18

1K+ Views

In this article, we will learn to print unique values from a List in Java. This program will use a loop-based approach to identify and display only the values that appear once, skipping any duplicates. This approach is helpful when working with datasets where you want to remove repeated items ... Read More

Java – MySQL connection with ipAddress

AmitDiwan

AmitDiwan

Updated on 08-Nov-2024 22:29:37

931 Views

In this article, we will learn how to connect a Java application to a MySQL database hosted on a specific IP address. By specifying the IP address in the connection URL, we can directly connect to the database even if it’s on a different machine. We’ll use the DriverManager.getConnection() method ... Read More

Java program to find the number occurring odd number of times

AmitDiwan

AmitDiwan

Updated on 07-Nov-2024 01:07:17

587 Views

In this article, we will learn how to find the number in an array that appears an odd number of times using Java. By looping through the array and counting occurrences of each number, the program will detect and return the one with an odd frequency. Problem Statement Given an ... Read More

Java program to remove all whitespaces from a string

AmitDiwan

AmitDiwan

Updated on 07-Nov-2024 01:05:37

390 Views

In this article, we will understand how to remove all whitespaces from a string in Java. The String class in Java represents a sequence of characters enclosed in double-quotes. Removing whitespaces from a string is a common operation, especially when processing user input or cleaning data. The replaceAll() method is ... Read More

Java program to check whether the given string is pangram

AmitDiwan

AmitDiwan

Updated on 05-Nov-2024 22:03:46

697 Views

In this article, we will understand how to check whether the given string is a pangram in Java. A string is a pangram string if it contains all the characters of the alphabet ignoring the case of the alphabet. Here, we will be using two different approaches: using the main() ... Read More

Java program for nth multiple of a number in Fibonacci Series

AmitDiwan

AmitDiwan

Updated on 05-Nov-2024 22:02:55

322 Views

In this article, we will learn how to find the nth multiple of a given number in the Fibonacci series using Java. The Fibonacci series is a sequence where each number is the sum of the two preceding ones. We will use loops, conditional statements, and the modulus operator to ... Read More

Java program to convert array into collection

AmitDiwan

AmitDiwan

Updated on 04-Nov-2024 18:44:02

789 Views

In this article, we will understand how to convert the array into a collection in Java. The Collection is a framework that provides an architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on data such ... Read More

Java program to print matrix in Z form

AmitDiwan

AmitDiwan

Updated on 29-Oct-2024 18:51:04

714 Views

In this article, we will learn to print a matrix in a "Z" pattern in Java. It starts from the top-left corner, moves horizontally across the top row, then diagonally down through the center, and finally across the bottom row. This pattern creates a "Z" shape with selected elements from ... Read More

Java program to print first letter of each word using regex

AmitDiwan

AmitDiwan

Updated on 29-Oct-2024 00:38:40

770 Views

In this article, we will understand how to print the first letter of each word using regex. A regular expression is a sequence of characters that forms a search pattern. A regular expression can be a single character or a more complicated pattern. A regular expression helps you match or ... Read More

Previous 1 ... 3 4 5 6 7 ... 1075 Next
Advertisements