Java programming exercise with solution : get name, change to uppercase and show on screen

Write a program what ask user to input Name, change name to uppercase and show greet sentence.

Put your name: yasolution
Hello, YASOLUTION. Nice to meet you.

Let's do and compare with me.


import java.util.Scanner;

public class ToUpperCase {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  String name;
  System.out.print("Put your name: ");
  Scanner myScanner = new Scanner(;
  name = myScanner.nextLine().toUpperCase();
  System.out.println("Hello, " + name + ". Nice to meet you.");


Please comment your code below. :)