对于hasNext以及hasNextLine的作用与逻辑的疑问

如题
对于使用
Scanner sc=new Scanner(System.in);
System.out.println("输入一个字符");
if(sc.hasNextLine()){
String s1= sc.nextLine();
System.out.println("你输入的字符为:"+s1);
}
和我平时写的
Scanner sc=new Scanner(System.in);
System.out.println("请输入一个字符");
String s2=sc.nextLine();
System.out.println("你输入的字符为:"+s2);
相比有什么额外的效果帮助吗
能够让我了解下两者的逻辑区别就更好了

可以看下这个:https://blog.csdn.net/weixin_36242811/article/details/105463062

如果输入流是System.in
那么两者没有区别 因为console的输入流hasNextLine()或者hasNext()会一直返回true (换句话说控制台输入不会终止)

而如果输入流是文件文本,那么空文件或者读到文件末尾后hasNext就会返回false