Articles on Trending Technologies

Technical articles with clear explanations and examples

Java program to check if a string contains any special character

AmitDiwan
AmitDiwan
Updated on 12-Aug-2024 5K+ Views

In Java, checking if a string contains special characters can be easily done using regular expressions. We will be using the Pattern and Matcher classes from the java.util.regex package, we can efficiently determine whether a string includes any special characters. In this article, we will demonstrate how to use these classes to perform the check and handle the result accordingly. − Problem Statement For a given string write a Java program to check if it contains any special character or not − Input 1 I Love Tutorialspoint Output 1 Special character not found in the string Input 2 ...

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 for longest increasing subsequence

AmitDiwan
AmitDiwan
Updated on 12-Aug-2024 2K+ Views

In this program, we find the length of the longest increasing subsequence (LIS) in an integer array using Java programming language. An increasing subsequence is a sequence of numbers where each number is greater than the previous one. The program uses a dynamic programming approach to compute the longest increasing subsequence efficiently. This technique involves building a solution using previously computed results. Problem Statement Write a Java program to get the length of the longest increasing subsequence − Input 10, 22, 9, 33, 21, 50, 41, 60 Output The length of the longest increasing subsequence is 5 Steps get ...

Read More

Difference Between GraphQL and Rest

Shirjeel Yunus
Shirjeel Yunus
Updated on 12-Aug-2024 260 Views

If you want to develop and design APIs that can be used to exchange data over the internet, you can go for GraphQL and Rest. HTTP verbs are used by applications that Rest enables to exchange data with the server. GraphQL is used to define the ways in which client applications have to request data from a remote server. In this article, we will discuss the difference between GraphQL and rest. What is GraphQL? GraphQL is an open-source query language which uses APIs to make changes in the data. It uses a server-side runtime engine for the manipulation of the ...

Read More

Java program to swap pair of characters

AmitDiwan
AmitDiwan
Updated on 09-Aug-2024 3K+ Views

In this article, we’ll learn how to swap pairs of characters in a Java string. We start with a simple method that converts the string into a character array, allowing us to swap characters directly. Then, we’ll explore an object-oriented approach where the swapping logic is encapsulated in a separate method. Both approaches highlight key Java concepts such as string manipulation and method encapsulation. Problem Statement Write a Java program to swap a pair of characters. Below is a demonstration of the same − Input  Input string: Java program Output The string after swapping is: Javg proaram Steps for basic ...

Read More

Java menu driven program to check positive negative or odd even number

Mr. Satyabrata
Mr. Satyabrata
Updated on 09-Aug-2024 2K+ 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. The 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 ...

Read More

Java program to print even length words

AmitDiwan
AmitDiwan
Updated on 09-Aug-2024 2K+ Views

In this article, we will understand how to print even-length words. The string is a datatype that contains one or more characters and is enclosed in double quotes (“ ”). Char is a datatype that contains an alphabets an integer or a special character. Problem Statement Write a Java program to print even-length words. Below is a demonstration of the same − Input Input string: Java Programming are cool Output  The words with even lengths are: Java cool Approaches to print even length words Below are the different approaches to print even length words − Using ...

Read More

Difference between IP address and Port Number

Shirjeel Yunus
Shirjeel Yunus
Updated on 09-Aug-2024 550 Views

Computers can communicate with each other over a network through port numbers and IP addresses. In this article, we will discuss the difference between IP Address and Port Number. What is an IP Address? IP Address can be expanded to Internet Protocol Address. This is an address which is used by a computer to receive data and information from other computers through the Internet. Billions of IP addresses are being used to make a connection between computers. These computers use either IPv4 or IPv6 addresses for making a connection. Previously IPv4 was used for networking as the number of users ...

Read More

Difference between Cloud Computing and Traditional Computing

Shirjeel Yunus
Shirjeel Yunus
Updated on 09-Aug-2024 6K+ Views

Traditional computing is a type of computing in which local servers are used and a lot of hardware and software has to be installed which is a very expensive process. Remote servers are used in cloud computing which helps in easy access to files, folders, websites, etc. In this article, we will discuss the difference between Traditional Computing and Cloud Computing. What is Cloud Computing? Cloud computing is s system which consists of configurable resources and advanced services which can be easily accessed with the help of the Internet. This leads to lower expenses related to power. Organizations can lower ...

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
Showing 32031–32040 of 61,297 articles
Advertisements