+ 1
Java scanner package
Write a Java Program That prompts the user to enter a password and displays it back in the console window. The displayed password should be the entered password halved with the full password total number of characters added at the end. >> who can solve this question for me with explanation !
3 Respostas
+ 1
import java.util.Scanner;
Scanner in = new Scanner(system.in);
System.out.println("enter password");
String s = in.nextLine(); //scans the input
int a = s.length(); //original password length
String b =s.substring(0, a/2); //get the half password
System.out.println("your password is" + b +""+ a);
0
please enter the password:
abcd
your password is: ab4
the output must show as the above
0
thanks a lot am gonna try it