Q:

How to build 1d array and find the number that are odd and divisible by 5?

I have a code that create a array of integers than the system check the entered number and find the odd and divisible number by 5 than it display the sum of this numbers.
but the problem is that my code did not show display anything 
so how to fix my code?
This is my code: 
package question2;

import java.util.Scanner;

public class SumOdd5 {

    static int[] array = new int[15];
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        System.out.println("Enter numbers");
        for(int i = 0; i<array.length; i++){
            array[i]=sc.nextInt();

        }
        sumOddDiv5();
    }

    public static int sumOddDiv5(){
        int sum;
        int odd = 0;
        for(int i = 0; i<array.length; i++){

            if(array[i] % 2 !=0 && array[i] % 5 ==0){
                odd++;
            }
        }
        sum = sum + odd;
    return sum;
    }
}

A:

As your problem statement says your code not printing sum,
1. You have not used sum variable to do sum.
2. You need to return your sum to print.  
 public class SumOdd5 {
    static int[] array = new int[15];
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        System.out.println("Enter numbers");
        for(int i = 0; i<array.length; i++){
            array[i]=sc.nextInt();
        }
        int sum = sumOddDiv5();
        System.out.println("Sum of Number : "+sum);
    }

    public static int sumOddDiv5(){
        int sum=0;
        for(int i = 0; i<array.length; i++){

            if(array[i] % 2 !=0 && array[i] % 5 ==0){
                  sum +=array[i]; 
            }
        }
        return sum;
    }
}

