Karthikeya Boyini has Published 1385 Articles

Basic calculator program using Java

karthikeya Boyini

karthikeya Boyini

Updated on 19-Aug-2024 18:30:26

24K+ Views

In this article, we will learn to create a basic calculator using Java. With a basic calculator, we can add, subtract, multiply, or divide two numbers. This is done using a switch case. A program that demonstrates this is given as follows − Problem Statement Write a program in Java to ... Read More

Java program to create a new list with values from existing list with Lambda Expressions

karthikeya Boyini

karthikeya Boyini

Updated on 12-Aug-2024 23:13:48

3K+ Views

In this article, we will demonstrate how to create a new list of employee names from an existing list of Employee objects using Lambda Expressions. We will utilize Java’s Stream API to efficiently map the employee data and collect it into a new list. Lambda Expressions: Lambda expressions simplify functional ... Read More

Java program to count the number of consonants in a given sentence

karthikeya Boyini

karthikeya Boyini

Updated on 08-Aug-2024 17:37:15

10K+ Views

In this article, we will count the number of consonants in a given sentence using Java to achieve this, we will use the Scanner class for user input and a for loop to iterate through each character in the sentence. By comparing each character with the vowels a, e, i, ... Read More

Java program to check for URL in a string

karthikeya Boyini

karthikeya Boyini

Updated on 07-Aug-2024 21:46:44

2K+ Views

In general, to check if a given string is a valid URL(Uniform Resource Locator), we will create a method that tries to form a URL object and catches any exceptions to determine if the string is a valid URL. By using Java's URL class and exception handling, we will demonstrate ... Read More

Java program to delete duplicate characters from a given String

karthikeya Boyini

karthikeya Boyini

Updated on 31-Jul-2024 17:49:38

3K+ Views

The Set interface does not allow duplicate elements, therefore, create a set object and try to add each element to it using the add() method in case of repetition of elements this method returns false − If you try to add all the elements of the array to a Set, ... Read More

Java program to double the size of an array

karthikeya Boyini

karthikeya Boyini

Updated on 02-Jul-2024 11:21:24

4K+ Views

In this article, we will learn how to double the size of an array in Java. This involves creating a new array with twice the length of the original array and copying the elements from the original array to the new, larger array. Problem Statement Create an initial array with ... Read More

Java Program to convert boolean to integer

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2024 14:39:45

13K+ Views

To convert boolean to integer, let us first declare a variable of boolean primitive. boolean bool = true; Now, to convert it to integer, let us now take an integer variable and return a value “1” for “true” and “0” for “false”. int val = (bool) ? 1 : 0; ... Read More

Java Program to count letters in a String

karthikeya Boyini

karthikeya Boyini

Updated on 31-May-2024 16:23:29

21K+ Views

Let’s say we have the following string, that has some letters and numbers.String str = "9as78";Now loop through the length of this string and use the Character.isLetter() method. Within that, use the charAt() method to check for each character/ number in the string.for (int i = 0; i < str.length(); ... Read More

Java Program to convert ASCII code to String

karthikeya Boyini

karthikeya Boyini

Updated on 31-May-2024 15:34:30

18K+ Views

To convert ASCII to string, use the toString() method. Using this method will return the associated character.Let’s say we have the following int value, which works as ASCII for us.int asciiVal = 89;Now, use the toString() method.String str = new Character((char) asciiVal).toString();Example Live Demopublic class Demo {    public static void ... Read More

How to Check Which Apache Modules are Enabled/Loaded in Ubuntu 16.04

karthikeya Boyini

karthikeya Boyini

Updated on 29-Feb-2024 13:55:47

412 Views

Apache is an open supply program on hand without cost. It runs on 67% of all web servers. It is speedy, risk-free, and comfortable. It may be extremely custom-made to satisfy the wants of many one-of-a-kind environments via utilizing extensions and modules.To install apache, use the following commands-$ sudo apt-get ... Read More

Advertisements