How to convert input char to uppercase automatically in Java

后端 未结 4 689
独厮守ぢ
独厮守ぢ 2020-12-19 19:23

I am using a Scanner class to get the input and want to convert the input to uppercase letter when display it. This is my code

Scanner input = new Scanner(Sy         


        
4条回答
  •  忘掉有多难
    2020-12-19 19:48

    Since, java is pass by value, you need to use the return value. Either print Character.toUpperCase(c) directly or set it to some var.

提交回复
热议问题