java

java

4 different Java program to find the HCF or GCD of two numbers

Learn to find the HCF or GCD of two numbers in Java with examples. We will show you four different ways to find the HCF or GCD of two user input numbers in this post.

Read
java

3 ways to convert System.nanoTime to seconds in Java

Three different ways in Java to convert System.nanoTime() to seconds. The System.nanoTime() method returns the time in nanoseconds. This post will show you how to convert this value to seconds with examples.

Read
java

Java String charAt method explanation with examples

Java String charAt method is used to find a character by using its index in a string. This method returns the character at any specific index. This post will show you how charAt works with examples.

Read
java

Different ways to add elements to an ArrayList in Java

Learn to add an element to the end of the ArrayList or at any specific position of the ArrayList in Java. This post will explain these with examples.

Read
java

Can we execute a Java program without the main method

Learn if we can execute a Java program without the main method or not. This post will give you an idea on static blocks of Java with examples.

Read
java

How to handle multiple exceptions in Java

Learn to handle multiple exceptions in Java with different catch blocks or with one single catch block with example for each.

Read
java

Can we have multiple public Java classes in one file

Learn if we can have two or more public classes in one file in Java or not. This post will explain it to you with different examples.

Read
java

3 different Java programs to find the next prime number

Java program to find the next prime number in 3 different ways. The program will take one number as an input from the user and print the next prime number found starting from the next number.

Read
java

Java program to calculate student's grades in 2 different ways

Java program to calculate the grade of a student with user input marks. The program will take the marks and print the grade for a student.

Read
java

2 different Java programs to check for Moran number

Java program to check if a number is a Moran number or not in two different ways. This post will show you how to check for a Moran number and how to find if a number is Moran or not.

Read