Write a program in Java to input a string and find the given character input by the user
present in the string. If present replace that character with ‘@’(without using replace()function) otherwise display not present
Answers
Answered by
0
Answer:
import java.util.*;
class UserInputDemo1
{
public static void main(String[] args)
{
Scanner sc= new Scanner(System.in); //System.in is a standard input stream
System.out.print("Enter a string: ");
String str= sc.nextLine(); //reads string
System.out.print("You have entered: "+str);
}
}
Explanation:
Answered by
0
Answer:
Given a string, find the first non-repeating character in it. For example, if the input string is “GeeksforGeeks”, then the output should be ‘f’ and if the input string is “GeeksQuiz”, then the output should be ‘G’.
Similar questions