Found 2616 Articles for Java

JAVA Program to Replace Element of Integer Array with Product of Other Elements

Mr. Satyabrata
Updated on 30-Dec-2022 14:00:34

4K+ Views

Array of Integers refers to an array where all the elements are of Integer type. It is alsocalled an Integer array. As per the problem statement we have to create an Integer array and display the array elements where all the array elements are the product of other elements of the array. In this article, we will see how to replace array elements by the product of other array elements by using Java programming language. To show you some instances − Instance-1 int arr[] = { 2, 3, 1, 4, 6 } At Index-0 value will be = 3 * ... Read More

Java Menu Driven Program to Perform Basic String Operations

Mr. Satyabrata
Updated on 27-Dec-2022 15:05:23

3K+ Views

String refers to a sequence of characters. In Java Strings are objects. To create and manipulate strings Java provides the String class. String class has many inbuilt methods which are used for different purposes. We will perform a few basic string operations by using inbuilt String methods. replace() Method: It replaces a specified character in the given string. concat() Method: It appends another string to the end of one string. length() Method: It returns the length of the given String. Equals() Method: It checks whether two strings are equal or not. In this article, we will see some basic ... Read More

Java Menu Driven Program to Perform Matrix Operation

Mr. Satyabrata
Updated on 27-Dec-2022 14:58:11

2K+ Views

Array in Java is called as a non primitive data type which stores a fixed number of single type values. It is called a one-dimensional array. Whereas matrix refers to a rectangular array or Two-Dimensional array. In this article, we will see how to perform different matrix operations like addition, subtraction, and multiplication by using Java Menu driven program. We will be implementing the application using a switch case. To show you some instances  Instance-1 Suppose we have inserted two different matrices of 2 rows and 3 columns. Then we will perform matrix addition and print the result. Let the ... Read More

Java Program to Enter a Number in Digit and Display in Words

Mr. Satyabrata
Updated on 27-Dec-2022 14:48:25

3K+ Views

Digits are basically represented in number format or these are integer values. But for pronouncing them we are using words. Every digit has a unique word format. For example, the word format of 1 is “One”. Like that for 2 the word format is “two”, for 3 the word format is “three” ... etc. For two-digit number the number format is little different. 21 represents as “twenty-one”, 45 represents as “forty-five” .... etc. So for all type of number there has a unique word format available. To show you some instances  Instance-1 Input number is 15. Word format of 15 ... Read More

Java Menu Driven Program to Perform Queue Operation

Mr. Satyabrata
Updated on 27-Dec-2022 14:44:17

649 Views

Queue is a linear data structure, in Java considered as a collection whch works on the principle of FIFO (First In First Out). In this article we will see how to perform different queue operations like Enqueue, Dequeue, front of the queue, size of the queue, is queue empty or not using Java programming language. We will be implementing the application using a switch case. To show you some instances  Instance-1 Suppose we have entered a queue of size 6 with elements [2, 6, 5, 8, 7, 3]. Then we will perform the Enqueue operation and add element 0. So ... Read More

Java Menu Driven Program to Perform Array Operation

Mr. Satyabrata
Updated on 27-Dec-2022 14:40:45

2K+ Views

Array in Java is called as a non primitive data type which stores a fixed number of single type values. It is called a One-dimensional array. In this article, we will see how to perform different array operations like checking duplicate elements, printing array in reverse order, checking largest element, checking smallest element, finding sum of all array elements by using Java Menu driven program. We will be implementing the application using a switch case. To show you some instances − Instance-1 Suppose we have created an array containing 6 elements and array elements are [2, 4, 6, 2, 6, ... Read More

Java Menu Driven Program to Determine Cost of New Membership

Mr. Satyabrata
Updated on 27-Dec-2022 14:38:24

250 Views

When we go anywhere for any type of membership they have different prices for different plans. For example silver membership, gold membership, diamond membership, platinum membership etc. where the silver membership costs less than others and platinum membership costs more than other plans. In this article we will see how to check the cost of a membership by using the Java programming language. We will be implementing the application using a switch case. To show you some instances  Instance-1 Suppose we have Rs 1840 as base membership price and you want to have a silver membership. The cost of silver ... Read More

Java Menu Driven Program to Check Type of a Number

Mr. Satyabrata
Updated on 27-Dec-2022 14:33:35

358 Views

In Java we have primitive numeric data types for numbers that are short, byte, int, long, float and double. These numeric data types allow us to represent different integer and real numbers based on their range as a specific data type has its lower and upper range. Below are the 6 primitive numeric data types  byte: Range -128 to 127 (Size 1 byte) short: Range -32, 768 to 32, 767 (Size 2 bytes) int: Range -2, 147, 483, 648 to 2, 147, 483, 647 (Size 4 bytes) long: Range -9, 223, 372, 036, 854, 775, 808 to 9, 223, 372, ... Read More

JAVA Menu Driven Program to Check Character is String, Number or Special Character

Mr. Satyabrata
Updated on 31-May-2024 14:47:53

10K+ Views

In this article, we will see a menu driven program to check if the entered character is number, string or special character by Java programming language. We will be implementing the application using a switch case. To show you some instances  Instance-1 Suppose the entered character is ‘a’ then the output should be “Entered character is a String”. Instance-2 Suppose the entered character is ‘1’ then the output should be “Entered character is a number”. Instance-3 Suppose the entered character is ‘$’ then the output should be “Entered character is a Special character”. Syntax To check whether ... Read More

Java Menu Driven Program to Check Positive Negative or Odd Even Number

Mr. Satyabrata
Updated on 27-Dec-2022 14:27:07

1K+ Views

A number is said to be a positive number if it is greater than 0 and if it is less than 0 then it is called a negative number. Negative number is followed by a minus sign (-) to identify it as a negative number. A number is said to be an even number if it is divisible by 2 else it is called an odd number. In this article we will see how to check if a number is positive, negative or even, odd by using Java programming language. We will be implementing the application using a switch case. ... Read More

Advertisements