java

java

Java program to convert a character to string

Java program to convert a character to string in different ways. We will learn two different ways to convert a character to a string in Java.

Read
java

3 different ways in Java to convert comma-separated strings to an ArrayList

Java program to convert comma separated strings to an ArrayList. This post will show you three different methods to convert comma separated strings to an ArrayList in Java.

Read
java

3 different ways to iterate over a HashSet in Java

Java program to iterate over the hashset items in three different ways. We will use an iterator, for loop and forEach to do that.

Read
java

How to remove specific items or remove all items from a HashSet

Java program to remove specific items or all items from a HashSet. Learn it with different examples.

Read
java

How to add items to a HashSet in Java

Java program to add items to a HashSet. We will use the add method of HashSet to add new items to a HashSet.

Read
java

Java program to find the maximum element in a HashSet

Java program to find the maximum element in a HashSet. we can either run a loop and find out the maximum or we can use the predefined method max defined in Collections.

Read
java

How to convert a negative number to positive in Java

Learn how to convert a negative number to positive in Java. We will learn two different ways to do the conversion in Java.

Read
java

Java program to get the epoch timestamp

How to get the epoch timestamp in Java. This post will show you number of milliseconds and seconds passed since epoch.

Read
java

Java program to find the absolute value of a number

Java program to find the absolute value of a number. We can use Math.abs method to find the absolute value of a number.

Read
java

Find the largest number from an array in Java

Java program to find the largest number that can be formed from an array of numbers. The program will take the numbers as input from the user.

Read