不知道这是什么问题,运行出错

arsaluo 2007-05-15 11:05:20
public static int getTCPServerPortNum()
{
int num = 0;///调试在此出错
String host = "localhost";
for (int i = 1; i < 65536; i++)
{
try
{
Socket s = new Socket(host, i);
}
catch (UnknownHostException ex)
{
System.err.println(ex);
break;// it is not a server port
}
catch (IOException e)
{
e.printStackTrace();
break;// it is not a server port
}
num++;
}
return num;

}
...全文
364 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
li_d_s 2007-05-15
  • 打赏
  • 举报
回复
运行出错,Exception信息呢?搞得一堆人在猜错误原因
arsaluo 2007-05-15
  • 打赏
  • 举报
回复
SystemInformation是类名 不是对象名 如果是对象名编译就通不过了
fancuixia 2007-05-15
  • 打赏
  • 举报
回复
抽象类不能创建实例, 所以SystemInformation.getTCPServerPortNum();不能执行。
arsaluo 2007-05-15
  • 打赏
  • 举报
回复
那我使用的时候这么写可以吗?

tcpServerPortNum = SystemInformation.getTCPServerPortNum();

SystemInformation为此抽象类的名字
tomkai 2007-05-15
  • 打赏
  • 举报
回复
这个方法没有问题啊
chengchaog 2007-05-15
  • 打赏
  • 举报
回复
这个是在抽象类中写的 会不会是这个问题?
------------------------------
没问题,可以有方法实现,看看jdk没问题不
约翰羊 2007-05-15
  • 打赏
  • 举报
回复
调试没问题啊
arsaluo 2007-05-15
  • 打赏
  • 举报
回复
这个是在抽象类中写的 会不会是这个问题?
li_d_s 2007-05-15
  • 打赏
  • 举报
回复
错误信息呢
arsaluo 2007-05-15
  • 打赏
  • 举报
回复
public static int getTCPServerPortNum()
{
int num = 0;///调试在此出错
String host = "localhost ";
for (int i = 1; i < 65536; i++)
{
try
{
Socket s = new Socket(host, i);
}
catch (UnknownHostException ex)
{
System.err.println(ex);
break;// it is not a server port
}
catch (IOException e)
{
e.printStackTrace();
break;// it is not a server port


==================================================================在这边处理错误
}
num++;
}
return num;

}








正确程序


public static int getTCPServerPortNum()
{
int num = 0;
String host = "localhost ";
for (int i = 1; i < 65536; i++)
{
try
{
Socket s = new Socket(host, i);
}
catch (UnknownHostException ex)
{
System.err.println(ex);
break;
}
catch (IOException e)
{
// it is not a server port
}
num++;
}
return num;

}
arsaluo 2007-05-15
  • 打赏
  • 举报
回复
public static int getTCPServerPortNum()
{
int num = 0;///调试在此出错
String host = "localhost";
for (int i = 1; i < 65536; i++)
{
try
{
Socket s = new Socket(host, i);
}
catch (UnknownHostException ex)
{
System.err.println(ex);
break;// it is not a server port
}
catch (IOException e)
{
e.printStackTrace();
break;// it is not a server port


==================================================================在这边处理错误
}
num++;
}
return num;

}








正确程序


public static int getTCPServerPortNum()
{
int num = 0;
String host = "localhost";
for (int i = 1; i < 65536; i++)
{
try
{
Socket s = new Socket(host, i);
}
catch (UnknownHostException ex)
{
System.err.println(ex);
break;// it is not a server port
}
catch (IOException e)
{
// it is not a server port
}
num++;
}
return num;

}
"Mstar Bin Tool"是一款专门针对Mstar系列芯片开发的固件处理软件,主要用于智能电视及相关电子设备的系统维护与深度定制。该工具包特别标注了"LETV USB SCRIPT"模块,表明其对乐视品牌设备具有兼容性,能够通过USB通信协议执行固件读写操作。作为一款专业的固件编辑器,它允许技术人员对Mstar芯片的底层二进制文件进行解析、修改与重构,从而实现系统功能的调整、性能优化或故障修复。 工具包中的核心组件包括固件编译环境、设备通信脚本、操作界面及技术文档等。其中"letv_usb_script"是一套针对乐视设备的自动化操作程序,可指导用户完成固件烧录全过程。而"mstar_bin"模块则专门处理芯片的二进制数据文件,支持固件版本的升级、降级或个性化定制。工具采用7-Zip压缩格式封装,用户需先使用解压软件提取文件内容。 操作前需确认目标设备采用Mstar芯片架构并具备完好的USB接口。建议预先备份设备原始固件作为恢复保障。通过编辑器修改固件参数时,可调整系统配置、增删功能模块或修复已知缺陷。执行刷机操作时需严格遵循脚本指示的步骤顺序,保持设备供电稳定,避免中断导致硬件损坏。该工具适用于具备嵌入式系统知识的开发人员或高级用户,在进行设备定制化开发、系统调试或维护修复时使用。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧