【问题标题】:Is there any way reading from a txt file and matching keywords有没有办法从 txt 文件中读取并匹配关键字
【发布时间】:2015-12-18 09:56:17
【问题描述】:

您好,我想制作一个 java 程序,它将读取一个 txt 文件,然后它应该将这些关键字与程序中给定的单词匹配。 我想在数组中匹配关键字和我自己的单词?

【问题讨论】:

  • 先修复所有编译错误会更好。 --- 我认为@SotiriosDelimanolis 给出的链接背后的重要部分是这个子链接中关于 Verifiable 的部分:stackoverflow.com/help/mcve,但是你应该全部阅读。
  • 如果你知道请帮忙

标签: java arrays file


【解决方案1】:

我尝试使用您的代码(或多或少)

public static void main(String[] args) {
    Scanner scanner =new Scanner(System.in);
    System.out.println("READ URL");
    String input = scanner.next();
    try {
        URL url1=new URL(input);
        System.out.println(url1);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

}

输入 www.example.com 失败,因为没有协议,但输入 http://www.example.com 工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多