karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 73 of 143

Basic calculator program using Java

karthikeya Boyini
karthikeya Boyini
Updated on 19-Aug-2024 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 create a basic calculator for performing the basic arithmetic operations − Input Enter two numbers: 23Enter an operator (+, -, *, /): + Output The result is given as follows:2.0 + 3.0 = 5.0 Steps to create basic calculator Following are the steps to create a basic calculator program using ...

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 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 programming by working with functional interfaces, which have only one method. A lambda expression provides a way to implement this method easily. Steps Following are the steps to create a new list with values from existing list with Lambda Expressions − Import the necessary classes ...

Read More

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

karthikeya Boyini
karthikeya Boyini
Updated on 08-Aug-2024 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, o, u, and ignoring spaces, we will identify consonants and increment a counter accordingly. The Scanner class is part of java.util package and is commonly used to obtain input from the user. Problem Statement Given a sentence, write a Java program to count the number of consonants. As given below ...

Read More

Java program to check for URL in a string

karthikeya Boyini
karthikeya Boyini
Updated on 07-Aug-2024 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 a straightforward approach to verify the correctness of URL strings. We can import from java.net package object is created from the input string, then converted to a URI using toURI() method. Problem Statement A program can be created to check if a string is a correct URL or not. An ...

Read More

Java program to delete duplicate characters from a given String

karthikeya Boyini
karthikeya Boyini
Updated on 31-Jul-2024 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, it accepts only unique elements so, to find duplicate characters in a given string. Problem Statement Given a string, write a program in Java to delete duplicate characters from a given string − Input TUTORIALSPOINT Output Indices of the duplicate characters in the given string :: Index :: ...

Read More

Java program to double the size of an array

karthikeya Boyini
karthikeya Boyini
Updated on 02-Jul-2024 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 predefined integer values and determine its length. Then, create a new array with double the length of the original array, copy the elements from the original array to the new one, and print the lengths of both the original and the new arrays to verify the resizing operation. Steps to ...

Read More

Java Program to convert boolean to integer

karthikeya Boyini
karthikeya Boyini
Updated on 25-Jun-2024 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; Let us now see the complete example to convert boolean to integer in Java. Example public class Demo {    public static void main(String[] args) {       // boolean       boolean bool = true;       System.out.println("Boolean Value: "+bool);       int val = (bool) ? 1 : 0;       // Integer       System.out.println("Integer value: "+val);    } }OutputBoolean Value: true Integer value: 1

Read More

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

karthikeya Boyini
karthikeya Boyini
Updated on 29-Feb-2024 425 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 update $ sudo apt-get install apache2 apache2ctlapcahe2ctl is a front end to the Apache HyperText switch Protocol (HTTP) server. It is designed to aid an administrator to control the functioning of the Apache HTTP daemon. To get the more information about apache2 modules, use the following command – $ man ...

Read More

Read file line by line using C++

karthikeya Boyini
karthikeya Boyini
Updated on 14-Sep-2023 26K+ Views

This is a C++ program to read file line by line.Inputtpoint.txt is having initial content as "Tutorials point."OutputTutorials point.AlgorithmBegin    Create an object newfile against the class fstream.    Call open() method to open a file “tpoint.txt” to perform write operation using object newfile.    If file is open then       Input a string “Tutorials point" in the tpoint.txt file.       Close the file object newfile using close() method.    Call open() method to open a file “tpoint.txt” to perform read operation using object newfile.    If file is open then       Declare a ...

Read More

Video Ads for Mobile Devices – A Successful Recipe for Your Digital Campaign

karthikeya Boyini
karthikeya Boyini
Updated on 13-May-2022 247 Views

Have you remembered your first book, the first lessons as a kid? Probably you may not recall the text written over there, but one thing you can surely recall that there were attractive images of animals, vehicles, fruits, vegetables and much more, isn’t it? And what about those videos of beautiful rhymes that you loved to watch being a kid? You can still remember a few of them, isn’t it? That is the power of video message; a good video can keep its viewer engaged and leave an impact which can be recalled after long years.So, why don’t you use ...

Read More
Showing 721–730 of 1,421 articles
« Prev 1 71 72 73 74 75 143 Next »
Advertisements