[英]Unhandled exception type ParseException with class object
RowsJ.getRows() 上出现以下错误; :未处理的异常类型 ParseException 。
public class Board
{
ReadJson r = new ReadJson();
long rows = r.getRows();
{
public static void main(String[] args)
{
System.out.println(rows);
}
}
getRows()方法从 JSON 文件返回一个长数字。
因为r是一个实例变量,我们需要使用 try/catch 才能使其正常工作。
public class Board
{
ReadJson r = new ReadJson();
long rows;
{
try
{
rows = r.getRows();
}
catch(Exception ParseException)
{
System.out.println("Something went wrong.");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.