java - 我以前有效的 if 语句不再有效
问题描述
我正在尝试创建一个 if else 语句,它一个接一个地检查多个值,以查看它们是否为空。
我之前创建的 if else 语句运行良好,但重新启动我的电脑后它不再工作。
任何帮助表示赞赏。
这是我的代码:
//Declare Strings
String ProjectNo, Location, VP;
//Store values from text boxes into strings
ProjectNo = txtProjectNum.getText();
Location = txtLocation.getText();
VP = txtVPNo.getText();
if(ProjectNo == null){
JOptionPane.showMessageDialog(null, "No fields can be left empty!");
}
else if (Location == null){
JOptionPane.showMessageDialog(null, "No fields can be left empty!");
}
else if (VP == null){
JOptionPane.showMessageDialog(null, "No fields can be left empty!");
}
else{
JOptionPane.showMessageDialog(null, "All fields have been filled in!");
}
解决方案
推荐阅读
- reporting-services - 基于两个数据日期的背景颜色
- angular - ngModel 更改多项选择
- python - 查询集中的python django纬度经度过滤器
- sharepoint - 拒绝 SharePoint 访问但允许电子邮件
- python - 更改图表标签轴的颜色
- python - ISO3166没有正确导入方法-Pycharm
- python - Python:如何在带有“{”字符的 SQL 字符串中插入变量?
- google-cloud-firestore - Firestore子集合查询
- azure - 将 Azure 策略定义部署到管理组权限
- android - 在约束布局上,BottomNavigationView 高度计算为零