• 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 Find Symbol

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a "Cannot Find Symbol" compiler error that I am having difficulty resolving.

The compiler says:


In TestArrays2.java I have:


In Arrays2.java I have:


Can someone point me in the right direction?

Thoughts appreciated.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your Arrays2.fill method expects an Object array, two ints and a BooleanGenerator to be passed to it. You're only passing an array and BooleanGenerator.

Also, if you're not using Java 1.5, you cannot pass an array of boolean primitives to a method that is expecting an array of Objects. I think autoboxing in java 1.5 will handle this.
 
Arthur Blair
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply, J.

Sorry, I forgot to include in my previous code listing. Array2.java includes this method which calls the overloaded fill() method.



...I'm using Java 1.5.0_03. So I should be able to pass a boolean array to this fill method right?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, a boolean array is not an Object array, and won't be autoboxed. You'd have to pass an array of java.lang.Boolean, or implement another version that accepted a boolean[] .
 
Arthur Blair
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ernest.

I fixed the problem my making the methods in Array2.java receive specific Wrapper class arrays instead of Object arrays.
 
knowledge is the difference between drudgery and strategic action -- tiny ad
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