Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner keyboard = new Scanner(System.in);
- String city;
- char letter;
- int stringSize;
- System.out.println("Please enter your favourite city: ");
- city = keyboard.nextLine();
- stringSize = city.length();
- letter = city.charAt(0);
- System.out.println("Number of characters in the name: " + stringSize);
- System.out.println("In upper case: " + city.toUpperCase());
- System.out.println("In lower case: " + city.toLowerCase());
- System.out.println("Firs character in the name: " + letter);
Advertisement
Add Comment
Please, Sign In to add comment