问题就在那里因为我想从文本文件制作标签然后把它放到VBOX中我得到inputmismatchexception并且它不会创建新的对象
1 nikto 10
2 nikto 0
3 nikto 0
4 nikto 0
5 nikto 0
6 nikto 0
7 nikto 0
8 nikto 0
9 nikto 0
10 nikto 0
文件内容:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": [
{
"_index": "company",
"_type": "external",
"_id": "2",
"_score": 1,
"_source": {
"name": "IBM",
"bloomberg": "IBMB34:BZ"
}
},
{
"_index": "company",
"_type": "external",
"_id": "1",
"_score": 1,
"_source": {
"name": "Apple",
"bloomberg": "AAPL34:BZ"
}
},
{
"_index": "company",
"_type": "external",
"_id": "3",
"_score": 1,
"_source": {
"name": "Microsoft",
"bloomberg": "MSFT34:BZ"
}
}
]
}
}
答案 0 :(得分:0)
您的扫描仪正在读取字符串“rebrickek.txt”而不是文件
File file = new File("rebricek.txt");
if(file.exist())
{
Scanner s = new Scanner(file);
.
.
.
}
else
{
System.out.println("The file does note exist!");
}