Getting an error message in code, but don't know what it means to do

import java.util.*;
import static java.lang.Math.*;
class Mid{
static Scanner console = new Scanner (System.in);
     public static void main(String args[]){
     int i = 0;
     int j = 0;
     int k = 0;
     int mid = 0;
     System.out.print("Enter an integer between 1 and 365: ");
     i = console.nextInt();
     j = console.nextInt();
     k = console.nextInt();
     System.out.println();
     if (i>j && j>k)
     mid = j;
     System.out.println(+ j);
     else if (i<j && j>k)
     mid = max(i, k);
     System.out.println(+ mid);
     else if (i>j && j<k)
     mid = min(i, k);
     System.out.println(+ mid);
     else if (i<j && j<k)
     mid = j;
     System.out.println(+ j);
}keeps telling me 'else' without 'if'
i don't get it, the program is supposed to work such that if i put in 3 distinct numbers, i, j, and k, i can use the program to find out which one is in the middle
Message was edited by:
kribraider414

An if statement without curly brackets only includes the first statement following it, e.g.
if(condition)
    doSomething(); //This one belongs inside the if
    doSomethingElse(); //This one is outside the ifwhereas
if(condition)
    doSomething(); //This one belongs inside the if
    doSomethingElse(); //This one is also inside the if
}So you else if statements are currently floating in the middle of nowhere.

Similar Messages

Maybe you are looking for

  • Photoshop CS5 Crashing Everytime Try open an image

    Today I rebooted after upgrading to OS 10.6.4. I also ran monolingual to cleanup all languages except english. Everytime I open CS5 now as soon as I try to open an image it crashes. I've disable open gl and the same thing occurs. The report is gives

  • Need Answer on ALE Service Layer

    In my  cusomized outbound program i am using a function module MASTER_IDOC_DISTRUBUTE to generate the IDOCS. I am passing the both sender and reciever values to the function module MASTER_IDOC_DISTRUBUTE then distribution model in BD64 is not require

  • Why do clients not install anything??

    New Win2k12 R2 WSUS server, Win2k8 R2 clients detect updates properly, even appear to download them... RSOP on the Win2k8 client servers shows the proper Group Policy and GPO are applied to the client. The clients can readily access http://wsus:8530/

  • Uninstall iTunes, need help...

    I have read that when uninstalling iTunes and related components it has to be done in a correct order. What happens if I didn't uninstall in the correct order? My computer seems unaffected, but I would still like to know. Can anyone help?

  • How to deploy a java application -- might be silly but just help me out

    Hi I�ve developed a java application in eclipse. How do I deploy it so that it can be used by others without the help of eclipse? I can run it in eclipse but how do I deliver it to my customers and how can they use it without the help of eclipse or u