Shriansh Kumar has Published 324 Articles

Java Program to return the elements at the odd position in a list

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:43:36

915 Views

What is the Odd Position in a List? In Java, a List does not have predefined odd and even positions. However, if one considers the first position as index 0, then an odd position in the given List would be any index that is not divisible by 2. To determine ... Read More

Java Program to remove all elements from a set in Java

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:42:49

2K+ Views

We are given a Set that contains multiple elements and our task is to write a Java program to remove elements from the Set. Here, the Set is an Sub Interface of the Java Collection Interface which defines a mathematical set. Removing Set Elements in Java To remove elements from ... Read More

Java Program to Find the Perimeter of a Rectangle

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:03:16

1K+ Views

For a given rectangle of length l and width w, write a Java program to find its perimeter. The Perimeter of a rectangle is calculated by adding the lengths of all the sides of the rectangle. Below is a demonstration of a rectangle, a quadrilateral with four right angles (90°). ... Read More

Java Program to Check if JVM is 32 or 64 bit

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:01:47

841 Views

In this article, we will learn how to determine whether the installed JVM in your system is 32 bit or 64 bit. For this operation, we use the getProperty() method of System class, which helps in retrieving system property of specified argument. In computer architecture, 32 bit and 64 bit ... Read More

Java Program to Format time in AM-PM format

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 10:59:17

2K+ Views

Time formatting is a process of converting date and time values into human-readable strings with specific formats. The resulting string describes how date/time values should be represented (such as flat files or human-readable output). In this article, we will understand how to format time in AM-PM format. In 12-hour ... Read More

Java Program To Find all the Subsets of a String

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 10:58:32

2K+ Views

In this article, we will understand how to find all the subsets of a string. In Java, String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). A part or a subset of string is called substring. Example Scenario: Input: string = JVM; ... Read More

Java program to print a multiplication table for any number

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 10:58:04

2K+ Views

For a given integer number, write a Java program to print its multiplication table. In mathematics, a multiplication table shows the product of two numbers. Printing Multiplication Table using for Loop In Java, a for loop is used when a specific block of code needs to be executed multiple times. ... Read More

JAVA Program to Convert Octal to Binary

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 10:56:06

1K+ Views

Both binary and octal are types of number systems with the base value 2 and 8, respectively. This article aims to explain how to convert octal to binary in Java, which is one of the frequently asked interview questions. A number system is a way of representing numbers. Each type ... Read More

Java Program for Case Specific Sorting

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 10:49:54

817 Views

Suppose you have a String that contains uppercase and lowercase characters both. We have to sort this given string in case specific order which means if the ith position in the given string had an uppercase letter then the newly sorted string must have uppercase letter at that position and ... Read More

Java program to find all duplicate characters in a string

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 10:46:49

65K+ Views

The duplicate characters in a string are those that occur more than once. In Java, String is a non-primitive datatype that contains one or more characters and is enclosed in double quotes(“ ”). As per the problem statement, we are given a string and our task is to write a ... Read More

Advertisements