Iterate Through Each Character of a String in Java

AmitDiwan
Updated on 29-Sep-2024 02:48:31

2K+ Views

In this article, we will understand how to iterate through each character of the string using Java. The string is a datatype that contains one or more characters and is enclosed in double quotes (“ ”). Char is a datatype that contains an alphabet an integer or a special character. Problem Statement Write a program to Iterate through each character of the string. Below is a demonstration of the same − Input The string is defined as: Java Program Output The characters in the string are: J, a, v, a, , P, r, o, g, r, a, m, Different approaches ... Read More

Sort ArrayList in Ascending Order in Java

AmitDiwan
Updated on 29-Sep-2024 02:48:17

1K+ Views

In this article, we will learn how to sort an ArrayList in ascending order using Java. Sorting allows us to arrange elements in a specific order. We will use the Collections.sort() method, which simplifies sorting, whether you're dealing with integers or strings. The program will demonstrate sorting an ArrayList of numbers and names in ascending order. Problem Statement Write a Java program that sorts an ArrayList of elements in ascending order. We'll look at two examples—one with integer values and another with string values. Input 1 Points[50, 29, 35, 11, 78, 64, 89, 67] Output 1 Points (ascending)[11, 29, 35, ... Read More

Find Area of a Trapezium in Java

AmitDiwan
Updated on 29-Sep-2024 02:48:03

933 Views

In this article, we will understand how to find the area of a trapezium using Java. The trapezium is a type of quadrilateral that has at least one pair of sides parallel to each other. The parallel sides of a trapezium are called bases and the non-parallel sides of a trapezium are called legs. It is also called a trapezoid. The area of a trapezium is calculated using the formula − (height/2 * (side_1 + side_2). i.e. Area = ½ x (sum of the lengths of the parallel sides) x perpendicular distance between parallel sides Below is a demonstration of ... Read More

Check if None of the Strings in the List Matches a Condition in Java

Nancy Den
Updated on 29-Sep-2024 02:47:46

932 Views

In this article, you will learn how to check if none of the strings in a list start with a specific letter using Java. This approach is useful for validating or filtering data. We will use the Stream API to evaluate the condition and return a boolean result based on whether any string starts with the given letter. Problem Statement Write a program in Java to check if none of the strings in the list matches the condition. Input pqr, stu, vwx, yza, vwxy Output No match for the starting letter as f? = true Steps to check if none of ... Read More

Set JComboBox in JOptionPane

George John
Updated on 29-Sep-2024 02:47:14

2K+ Views

In this article, we will explore how to create a graphical user interface (GUI) in Java using JComboBox and JOptionPane. The program will display a pop-up dialog that contains a drop-down list, allowing the user to select their favorite sport from a list. By default, one of the options will be pre-selected, but users can change the selection.  Steps to set JComboBox in JOptionPane Following are the steps to set JComboBox in JOptionPane − Create a JPanel by initializing a JPanel to hold the components. Create a JComboBox by setting up a JComboBox ... Read More

Get First Friday in a Month - Java Program

Samual Sam
Updated on 29-Sep-2024 02:47:00

773 Views

In this article, we'll explore how to get the first Friday of any given month in Java. The program will use Java's LocalDate class and TemporalAdjusters to automatically calculate the first Friday based on the input date. We will walk through how this works step by step and see how the code performs this task. Problem Statement Write a program in Java to get the first Friday in a month. Below is a demonstration of the same − Input Current date = 2019-04-01 Output Current date = 2019-04-01 First Friday date = 2019-04-05 Steps to get the first Friday in a ... Read More

Fading Text Animation Effect Using CSS3

Nikhilesh Aleti
Updated on 27-Sep-2024 17:45:31

5K+ Views

Fading is a visual representation of a gradual transition between two states of visibility. We can perform fading animation using the @keyframes rule and opacity property in CSS3. In this article we are having two div boxes with some written content in the child div. Our task is to apply fading text animation effect using CSS3. Types of Fading Animation There are two types of fading animations which are listed below: Fade-In Text Animation Fade-Out Text Animation Fade-In Text Animation Fade-in text animation makes a text appear gradually from ... Read More

Make an Area Unclickable with CSS

Geetansh Sahni
Updated on 27-Sep-2024 12:48:35

20K+ Views

To make an area unclickable with CSS, we can use various CSS properties, which we will be understanding in this article. We will be discussing three different approaches to make an area unclickable with CSS. In this article we are having a rectangular area, our task is to make an area unclickable with CSS. Approaches to Make an Area Unclickable Here is a list of approaches to make an area unclickable with CSS which we will be discussing in this article with stepwise explaination and complete example codes. Unclickable Area using pointer-events property ... Read More

Design Loan EMI Calculator Using HTML, CSS, and JavaScript

Kalyan Mishra
Updated on 26-Sep-2024 17:41:46

11K+ Views

To design a Loan EMI Calculator, we will be using HTML to create basic structure of EMI loan calcualtor, CSS to design the UI and JavaScript to add functionality of calculating the EMI based on user input of amount, rate per annum and time in months. In this article, we will be understanding the stepwise process and code of how to design a loan EMI calculator using HTML, CSS and JavaScript. Structuring Loan EMI Calculator using HTML Designing UI of Loan EMI Calculator using CSS Adding ... Read More

HTML5 Input Types You May Not Be Using

Deepak Subhash
Updated on 26-Sep-2024 11:25:48

187 Views

An HTML5 input type enhances user experience and minimizes the requirement for JavaScript validation. Some HTML5 input types that are rarely used but can noteworthily improve form on websites are listed below. HTML5 input type ValuesInput TypePurposeNumeric keypads are displayed on mobile browsers, thereby enhancing UX on devices.Any specific date can be picked from a calendar, securing proper format.It minimizes the complexities of entering inputs for month/year related data. For example, setting up the expiry date of credit cards.It unifies the selection of files directly into the form and can specify the acceptable file types.It can be used to ... Read More

Advertisements