Shriansh Kumar has Published 324 Articles

Java Program to Convert OutputStream to String

Shriansh Kumar

Shriansh Kumar

Updated on 05-Aug-2024 18:10:08

2K+ Views

The process of converting an OutputStream to a String is used during unit testing when it is necessary to check the content of the OutputStream before displaying it. In this article, we will explain Java programs to convert OutputStream into String. Here, String is a class in Java which represents ... Read More

Java program to find whether the given character is an alphabet or not

Shriansh Kumar

Shriansh Kumar

Updated on 05-Aug-2024 18:09:20

3K+ Views

For a character "ch", write a Java program to verify whether it lies between a and z (both small and capital). If it does it is an alphabet otherwise, not. Alphabets are the set of letters written to represent particular sounds in a spoken language like English. Example Scenario 1: ... Read More

Java Program to convert string to byte

Shriansh Kumar

Shriansh Kumar

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

1K+ Views

Suppose you are given a String named "str". Now, your task is to write a Java program to convert the given string to Byte. String is a class in Java which stores sequence of characters within double quotes and Byte is a wrapper class of java.lang package which wraps value ... Read More

Java Program for check if a given number is Fibonacci number?

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:57:13

2K+ Views

For a given input number, write a Java program to check if it is a Fibonacci number. Any number that belongs to Fibonacci series is called as Fibonacci number. The Fibonacci series is a sequence of numbers formed by the sum of its two previous integers. The first two terms ... Read More

Java Program to Check Whether a Number is Prime or Not

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:55:27

27K+ Views

Given a number, let's say N, write a Java program to check whether the given number is prime or not. Prime numbers are special numbers with only two factors 1 and that number itself, they cannot be divided by any other number. Example Scenario 1 Input: num = 1; Output: ... Read More

Java Program to Check whether the input number is a Neon Number

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:54:45

1K+ Views

In this article, we will understand how to check whether the given input number is a neon number. A neon number is such a number whose sum of digits of square of the number is equal to the number itself. Example Scenario: Input: num = 9; Output: The given input ... Read More

Java Program to compare dates if a date is after another date

Shriansh Kumar

Shriansh Kumar

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

1K+ Views

In Java, there are a few scenarios where we are required to work with the date and time such as while developing a calendar application, attendance management system in Java and checking age of two persons. Also, the date is a way of keeping track of our time as it ... Read More

Java program to iterate over arrays using for and foreach loop

Shriansh Kumar

Shriansh Kumar

Updated on 01-Aug-2024 11:48:10

497 Views

In Java, both for loop and the for-each loop are used to iterate over each element of a stream or collection like arrays and ArrayList in order to perform desired operations. In this article, we will learn how to iterate over elements of an array using for and for-each loop. ... Read More

Java String Concatenation with Other Data Types.

Shriansh Kumar

Shriansh Kumar

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

2K+ Views

In Java, string concatenation is the operation of joining two or more strings together. However, string concatenation can be performed with various primitive data types, not just with other strings. Two strings can be concatenated using concat() method of String class, but, to concatenate strings with other primitive data type ... Read More

Java 8 Streams and its operations

Shriansh Kumar

Shriansh Kumar

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

2K+ Views

In Java, stream was introduced in Java 8. It represents a collection of elements and supports functional operations on those collections. Here, we are talking about collections like Array, List and Set. The Stream API simply channelizes the elements of sources through various built-in methods to return the desired result. ... Read More

Advertisements