java

java

3 ways in Java to print Hello World without semicolon

Java program to print hello world or any other string without semicolon. We will use if-else statement, for loop and StringBuilder append method to print the message without any semicolon in Java.

Read
java

Java program to find the power of a number using recursion

Java program to find the power of a number using recursion. This post will show you what is a recursive function and how to find the power of a number using recursion in Java.

Read
java

Java program to calculate compound interest

Java program to calculate compound interest with user-input values. Learn the formula to calculate compound interest and how to write it programmatically using Java.

Read
java

5 ways in Java to print the total number of days in a month

Java program to print the total number of days in a given month of a year. The program will take the month and year values as inputs from the user and print the number of days for that month in 5 different ways.

Read
java

How to remove all white spaces from a file in Java

Java program to remove all white spaces from a file. This program will show you how to read a text file line by line and how to remove all white spaces from the lines of this file with an example.

Read
java

Java program to print an upper triangular matrix

Java program to print an upper triangular matrix. This program will take one matrix as its input and convert it to an upper triangular matrix.

Read
java

Java program to print odd numbers from 1 to 100

Java program to print odd numbers from 1 to 100 or in a given range. We will learn three different ways to print all odd numbers in a user-given range using Java.

Read
java

Java program to convert an image to Base64 in 2 different ways

Learn how to convert an image to Base64 in 2 different ways in Java. We will use ImageIO and nio.file.Files to do the Base64 conversion with examples in this post.

Read
java

4 different Java programs to convert a list to set

Learn how to convert a list to set in Java in different ways. This post will show you 4 different ways to convert a list to set in Java with example programs.

Read
java

Java program to check for disjoint sets in two ways

Learn how to check for disjoint sets in Java in two different ways. We will use iterative approach and Collections.disjoint method to check for disjoint sets in this example.

Read