• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

cannot be applied to given types

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




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.
 
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Liar, liar, pants on fire! refreshing plug:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic