1

The error I am getting is class expected? I want to be able to pass in an array of anything. I do not understand why it does not work.

  public static <T extends Comparable<T>> T Max(T value[])
      {
           T max = value[0];

           for(int x = 0; x < value[].length; x++) //here I get the error
           {
               if(value[x].compareTo(max) > 0)
                   max = value[x];
           }


          return max;
      }
1
  • 2
    value.length not value[].length Commented Aug 17, 2013 at 22:16

1 Answer 1

4

What about value[].length? Correct would be value.length.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.