String password = "", newPassword = password + 2; char char1 = password.charAt(1), char2 = password.charAt(2), char3 = password.charAt(3), char4 = password.charAt(4), char5 = password.charAt(5), char6 = password.charAt(6); System.out.println("Enter a 6-character password. The first three characters should be capital letters of " + "the alphabet\nand the last three should be numbers from 1 to 9."); password = keyboard.next(); if((char1 != 65 && !(char1 < 90)) || (char2 != 65 && !(char2 < 90)) || (char3 != 65 && !(char3 < 90))) System.out.println("Incorrect characters. Re-enter password."); password = keyboard.next(); if((char4 != 1 && !(char4 < 9)) || (char5 != 1 && !(char5 < 9)) || (char6 != 1 && !(char6 < 9))) System.out.println("Incorrect characters. Re-enter password."); password = keyboard.next(); System.out.print(password + "\n" + newPassword);
String password = "password123456"; char[] characters = password.toCharArray(); for(int i=0;i<characters.length;i++) { System.out.println(characters[i]); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)