这个问题在这里已有答案: java.util.NoSuchElementException:找不到行 6个答案 回文是一个向后或向前读取相同的词。 编写一个函数来检查给定的单词是否是回文。 字符大小写应该被忽略。 我创建了一个方法isPalindrome( ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
如何解决此错误?
java.util.NoSuchElementException:找不到行。
我看了其他类似的文章,但不知道该怎么办。 在我看来,就像每个sc.nextLine();一样。 有一条对应的线。
抱歉,重要代码在下面,对您不好的理解/理解。 这是我第一次来,我才刚刚开始编程。
package assignment2;
import java.util.Scanner;
public class StringToolsTester {
public static void main(String[] args) {
StringTools obj = new StringTools();
//Method to get the reverse of the users string input
Scanner s = new Scanner(System.in);
System.out.print("reverse - Enter Any String: ");
String z = s.nextLine();
System.out.println("Reversed String: "+obj.reverse(z));
s.close();
//Method to get initials of the users string input
Scanner a = new Scanner(System.in);
System.out.print("initials - Enter Full Name: ");
String initial = a.nextLine();
System.out.println("Initials: "+obj.initials(initial));
a.close();
//Method to get the most frequent character from the users string input
Scanner b = new Scanner(System.in);
System.out.print("mostFrequent - Enter String: ");
String most = b.nextLine();
System.out.println("Most frequent character = "+obj.mostFrequent(most));
b.close();
//Method to get the binary equivalent of the users binary string input
Scanner c = new Scanner(System.in);
System.out.print("binaryToDecimal - Enter Binary: ");
String str = c.nextLine();
System.out.println(StringTools.binaryToDecimal(str));
c.close();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.