mercredi 20 février 2019

What is wrong in this java code. It says "Terminated Application" in Eclipse

package javagain;

public class Gender_interest {
    public static void main(String args[]) {

        if((args[0] == "Female") && (Integer.parseInt(args[1])>=1) && (Integer.parseInt(args[1])<=58)) {
            System.out.println("Percentge of Interest is 8.2%");
        }

        else if((args[0] == "Male") && (Integer.parseInt(args[1])>=1) && (Integer.parseInt(args[1])<=58)) {
            System.out.println("Percentge of Interest is 8.4%");
        }

        else if((args[0] == "Female") && (Integer.parseInt(args[1])>=59) && (Integer.parseInt(args[1])<=100)) {
            System.out.println("Percentge of Interest is 9.2%");
        }

        else if((args[0] == "Male") && (Integer.parseInt(args[1])>=59) && (Integer.parseInt(args[1])<=100)) {
            System.out.println("Percentge of Interest is 10.5%");
        }

        else {
            System.out.println("Enter correct values.");

        }
    }
}

Aucun commentaire:

Enregistrer un commentaire