aspose file tools*
The moose likes Beginning Java and the fly likes cannot be applied to given types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot be applied to given types" Watch "cannot be applied to given types" New topic
Author

cannot be applied to given types

Tom Cummings
Greenhorn

Joined: Nov 08, 2012
Posts: 7




System.out.println ("\n\nThe Average of integer values is:\t" + mylists.average(integerList)); This part gives me this error: MyList12 cannot be applied to given type and I'm not sure why.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39828
    
  28
Welcome to the Ranch
Tom Cummings wrote: . . .
System.out.println ("\n\nThe Average of integer values is:\t" + mylists.average(integerList)); This part gives me this error: MyList12 cannot be applied to given type and I'm not sure why.
Your integer list is a List of some sort and the method seems to take an int[] as a parameter. You need to ensure that you call the methods with the right arguments. You may wish to overload that method to take the list.
Your indenting is peculiar: it is usual to indent else ifs like thisAlso use spaces, not tabs for indenting.
Avoid numbers: classes like MyLists12 (whose spelling varies in your post) are confusing because you can’t always remember the difference from MyLists11.
Avoid use of the \n character unless you specifically want LF; use the %n tag instead.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8220
    
  23

Tom Cummings wrote:System.out.println ("\n\nThe Average of integer values is:\t" + mylists.average(integerList)); This part gives me this error: MyList12 cannot be applied to given type and I'm not sure why.

Neither are we unless you can tell us where this error is occurring.

However, the whole class seems a bit tortuous. From its fields, I would assume that it defines a List element, but then you have a pile of methods that appear to be based on Lists.

My suggestion: back up a bit and write down what you want, NOT how you want to do it. And just off the top of my head, a Student class (or something like it) sounds to me like a pre-requisite.

Winston

PS: I broke up that enormous line. Please re-read the UseCodeTags page for details.
Also, your populateLists() method is awful. Dealing with that many parameters (most of them Lists) is likely to be an absolute nightmare.


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot be applied to given types