[Solved] Nested Java methods [closed]


You cannot nest method declarations. However, you can simply define them separately and call one from the other. That is the purpose of functions.

public static boolean divides(int num, int denom)
{
    if (num%denom==0)
       return true;
    else return false; 
}

public static boolean isLeapYear(int year)
{
    return divided(x, y);  // not sure what you are trying to divide, but fill in x and y.
}

1

solved Nested Java methods [closed]