字符串sm1 = combo2.getSelectedItem()。toString();

  if("Software Engineering ".equals(sm1)){
       String s1 = txt1.getText();
      int t1 = Integer.parseInt(s1);
      double avg;

      avg = t1/15*100;
      String finalanswer = Double.toString(avg);
      ans.setText(finalanswer);


o \是正确的,因为标签未获取值并指示

最佳答案

您真的打算在"Software Engineering "中使用尾随空格吗?

也许您应该将其与"Software Engineering"进行比较:

if ("Software Engineering".equals(sm1)) {

10-05 23:27