Check Occurrence of Each Character in a String in Java

Chandu yadav
Updated on 05-Sep-2024 11:23:51

26K+ Views

To find the occurrence of each character in a string we can use the Map utility of Java. In Map a key cannot be duplicated so make each character of the string a key of Map and provide the initial value corresponding to each key as 1 if this character is not inserted in Map before. Now when a character repeats during insertion as a key in Map increases its value by one. Continue this for each character until all characters of the string get inserted. Problem Statement Write a program in Java to check the occurrence of each character in ... Read More

Find Sum of Natural Numbers Using While Loop in Java

Shiva Keerthi
Updated on 05-Sep-2024 11:23:05

713 Views

The sum of natural numbers can be calculated using different Iterative Statements in Programming Languages. Iterative Statements are statements that execute a particular set of code lines until the condition in the loop statement fails. In this article, we will discuss how to calculate the sum of natural numbers using a while-loop which is an iterative statement in Java. Sum of Natural Numbers The sum of natural numbers generally indicates the total sum of elements from 1 to n. Mathematically it can be represented as follows Sum of n Natural Numbers = 1+2+3+.........+(n-2) + (n-1) + n ... Read More

Get Milliseconds Between Dates in Java

karthikeya Boyini
Updated on 05-Sep-2024 11:22:45

2K+ Views

In this article, we will learn to get milliseconds between dates in Java. We will be using the LocalDateTime class from java.time package and ChronoUnit.MILLIS of java.time.temporal package. ChronoUnit is an enum that is part of Java date and time API which represents a unit of time that is days, hours, minutes etc. Here, the MILLIS is a unit that represents the concept of a millisecond. Problem Statement Write a program in Jave to get milliseconds between dates. Below is the representation − Input Date One = 2024-09-04T05:40:19.817038951Date Two = 2019-04-10T11:20 Output Milliseconds between two dates = -170533219817 Steps to get milliseconds between dates ... Read More

Find Sum of Even Factors of a Number in Java

AmitDiwan
Updated on 05-Sep-2024 11:22:18

991 Views

In this article we’ll find the sum of even factors of a given number using Java. We’ll start by checking if the number is even, then identify all of its factors, sum up those that are even, and finally display the result. Problem Statement Write a Java program to find the sum of even factors of a number. Below is the demostration of the same − Input num=16 Ouput The sum of even factors of the number is 30 Steps to find sum of even factors of a number Following are the steps to find sum of even factors of a number ... Read More

Subtract 1 Year from the Calendar in Java

Samual Sam
Updated on 05-Sep-2024 11:21:31

2K+ Views

In this article, we will subtract one year from the calendar in Java. We will be using Calender class from the java.util package. The program captures the current date, subtracts one year from it, and then displays the updated date. Problem Statement Write a Java program to subtract one year from the calendar. Below is a demonstration of the same − Input Current Date = Fri Nov 23 06:39:40 UTC 2018 Output Updated Date = Thu Nov 23 06:39:40 UTC 2017 Steps to subtract 1 year from the calendar Following are the steps to subtract 1 year from the calendar − ... Read More

Difference Between A* and AO* Algorithm

Abhijat Sarari
Updated on 04-Sep-2024 18:38:29

8K+ Views

In the fields of artificial intelligence and computer science search algorithms are essential for resolving challenging issues. Envision yourself searching for the way out of an enormous maze. You might aimlessly attempt every route in the hopes of failing. But wouldn't it be preferable to have a knowledgeable guide who is familiar with the maze ? In the digital realm, search algorithms are precisely like that! They assist computers much like you in a maze of options in determining the optimal course. The algorithms A* and AO* are two examples. In this blog article we'll go over their definitions, mechanisms, ... Read More

Apply Multiple Transform Property to an Element using CSS

Riya Kumari
Updated on 04-Sep-2024 16:55:22

5K+ Views

To apply multiple transform property to an element using CSS, we will be using two different methods which uses transformation property. In first approach we will be using two function of transform property whereas in second method we will be using nested class to apply different transformations. In this article, we are having a container with background image and our task is to apply multiple transform property to an element using CSS. Methods to Apply Multiple Transform to an Element Applying Multiple Transform Values Applying Multiple Transformation using Nesting of ... Read More

Rotate Container Background Image Using CSS

Shabaz Alam
Updated on 04-Sep-2024 13:31:43

9K+ Views

To rotate container background image using CSS, is a powerful tool to control and enhance the visual presentation of a website. In this article, we will be understanding three different approaches to rotate container background image Using CSS. We are having a background image in a div container, our task is to rotate container background image using CSS. Approaches to Rotate Container Background Image Using CSS Here is a list of approaches to rotate container background image using CSS which we will be discussing in this article with stepwise explaination and complete example codes. Rotate ... Read More

3D Printing: What It Is, How It Works, Examples

Shirjeel Yunus
Updated on 04-Sep-2024 13:26:14

1K+ Views

Table of Content What is 3D Printing? History of 3D Printing Types of 3D Printing Materials used in 3D Printing 3D Printing Uses and Examples How to choose a 3D Printer Design Guidelines for 3D Printing 3D Printing Software 3D Printing Vs. Additive Manufacturing 3D Printing Vs. Rapid Prototyping 3D Printing Vs 4D Printing Future of 3D Printing Advantages of 3D Printing Disadvantages of 3D Printing Conclusion FAQs on 3D Printing What is 3D Printing? 3D printing is a process in which three-dimensional objects are created from a file. Additive processes are used to create the 3D objects. ... Read More

Check the Version of ReactJS

Mohammed Shahnawaz Alam
Updated on 04-Sep-2024 10:52:25

2K+ Views

ReactJS is a frontend library of JavaScript to build efficient Single Page Application(SPA). Each version of React comes with some improvements and added features. So, it is very important to know which version we are using. Approaches to Check React Version We can check the version of ReactJS by using the below-mentioned Approaches. Using Command Line Using ‘React.version' Property Searching in dependencies in package.json React Version Using Command Line We can use the below command to check the version of ReactJS. The below command ... Read More

Advertisements