mercredi 27 février 2019

Logical operation "else without if" [on hold]

I am having problem with the if else statements. The moment I'm using "If", the error says "cannot resolve method 'if(boolean)'. And other error that says "else without if"

Please help.

 package com.learn.test;

    import javax.swing.*;

    public class test
    {
        public static void main(String[] args)
        {
            int number;
            String input;

            input = JOptionPane.showInputDialog("Enter your marks:");
            number = Integer.parseInt(input);

            If (number == 10)
            {
                JOptionPane.showMessageDialog(null, "The number is 10");
            }

            else if (number > 10)
            {
                JOptionPane.showMessageDialog(null, "The number is greater than 10");


            }


            }

}

Aucun commentaire:

Enregistrer un commentaire