Question: Do correctly in java 1)Java Program to Count The Product of Numbers in a String We need to find the product of the numbers present

Do correctly in java

1)Java Program to Count The Product of Numbers in a String

We need to find the product of the numbers present in the string. We can have alphabets as well as some digits so we need to find the product of the digits.

Input:- 4PREP2INSTAA6HFRE7

Output:- 336

2)

Write a program to reverse the given string word by word Note: Use the concept of loops

Sample Input: Hi Good Evening

Sample Output: iH dooG gninevE

3)

Write a Java method to check whether a string is a valid password.

Password rules:

The password should not contain any space.

Password should contain at least one digit(0-9).

Password length should be between 8 to 15 characters.

Password should contain at least one lowercase letter(a-z).

Password should contain at least one uppercase letter(A-Z).

Password should contain at least one special character specified ( #, %, &, $).

Sample Input: Alpha#3579

Sample Output: Valid

4)

Write a program to remove leading and trailing spaces from a string in Java

Approach 1:

To remove leading and trailing spaces in Java, use the trim() method. This method returns a copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.

Approach 2:

Remove the spaces without using the trim()

Sample Input: " Hi good evening "

Sample Output: "Hi good evening"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!