0

I have the following class

public class TestAlgorithm<E extends Comparable<? super E>> 
{
    public void testing(E[] array)
    {
        for(int i = 0; i<= array.length; i++)
        {
            ... // processing code (not important here)
        }
    }
}

in my main application class class I have this...

public static void main(String[] args)
{
    int [] test = {3,7,8,5,2,1,9,5,4};
    TestAlgorithm<Integer> myAlgo = new TestAlgorithm<Integer>();

    myAlgo.testing(test);
}

Which to me - looks like it makes sense - but I get the following error when I try to run it...

The method testing(Integer[]) in the type TestAlgorithm is not applicable for the arguments (int[]) app.java /TestApp/src/Application line 10 Java Problem

0

1 Answer 1

2

You defined myAlgo as Integer type, but you are calling a vector of int. Use an Integer vector:

Integer[] test = {3,7,8,5,2,1,9,5,4};
Sign up to request clarification or add additional context in comments.

1 Comment

I feel like such an idiot. Thanks!!!!!!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.