Because,

file1.toUpperCase() only makes the String name the user entered go to upper case. It doesn't make the data in that file go to upper case.

You need not have file2 as file1.nextLine();...