Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HelloWorld
- {
- public static void main(String[] args)
- {
- String favCity;
- Scanner keyboard = new Scanner(System.in);
- System.out.print("What is your favourite City? ");
- favCity = keyboard.nextLine();
- keyboard.close();
- String upperCase = favCity.toUpperCase();
- String lowerCase = favCity.toLowerCase();
- int length = favCity.length();
- char firstChar = favCity.charAt(0);
- System.out.println(length);
- System.out.println(upperCase);
- System.out.println(lowerCase);
- System.out.println(firstChar);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement