using class Object in Java
<h3>about answers below, thanks a lot but it doesn't work, may be problem also with loop for in main?</h3>

<p>hello everyone I have some problems in Java, I have those declarations:</p>

<pre><code>Double first1 = 1.2;
Integer first2 = 1;

Object[] input = {first1, first2};
</code></pre>

<p>after I'm trying to call some function from this class:</p>

<pre><code>public class Summer{
    public &lt;Y&gt; void sum(Y first){
        //do something
    }
}
</code></pre>

<p>but I receive an error:</p>

<pre><code>The method sum(Y) in the type Summer is not applicable for the arguments (Object)
</code></pre>

<p>can somebody explain please why and how can I make it right, thanks in advance</p>

<h3>Edited, I have a lot of code:</h3>

<pre><code>public class Main {
    public static void main(String[] args) {

        //arrays for input
        Integer[] intInput1 = {0, 1, 2, 3, 4};
        Integer[] intInput2 = {-3, -2, -1, 0 , 1};
        Boolean[] boolInput = {false, false, false, false, false};
        String[] stringInput = {"abc", "abc", "abc", "abc", "abc"};
        Character[] charInput = {'a', 'a', 'a', 'a', 'a'};

        //arrays for output
        Double[] output1 = new Double[5];
        Boolean[] output2 = new Boolean[5];
        Integer[] output3 = new Integer[5];
        Integer[] output4 = new Integer[5];
        String[] output5 = new String[5];

        //declaring first element
        Double first1 = 1.2;
        Boolean first2 = false;
        Integer first3 = 1;
        Integer first4 = 2;
        String first5 = "mama";

        //for saving from repetition
        Object[] first = {first1, first2, first3, first4, first5};
        Object[] output = {output1, output2, output3, output4, output5};
        Object[] input = {intInput1, intInput2, boolInput, stringInput, charInput};
        Object[] foo = {new sumIntToReal(), new sumIntToBool(), new sumBoolToInt(),
                new sumStringToInt(), new sumCharToString()};

        Summer summing = new Summer();

        for(int j = 0; j &lt; 5; j++){
            summing.sum(input[j], first[j], foo[j], output[j]);

        }


    }//function main ends
}//class ends
</code></pre>

<h3>sum</h3>

<pre><code>public class Summer{
    public &lt;X,Y&gt; Y[] sum(X[] inArr, Y first, SumFunction&lt;Y,X&gt; f, Y[] outArr){
        for(int i = 0; i &lt; inArr.length; i++){
            outArr[i] = f.op(first, inArr[i]);
            first = outArr[i];
        }
        return outArr;
    }
}
</code></pre>

<h3>error</h3>

<pre><code>The method sum(X[], Y, SumFunction&lt;Y,X&gt;, Y[]) in the type Summer is not applicable for the arguments (Object, Object, Object, Object)
</code></pre>
