• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

String[][] can't be converted to int [] .. How to fix it???

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


Can you fixed it? I dont know the problem..

Example :

How many names do you want to input : 2

Name 1 : Boby Boly
Name 2 : John Joly

Name that you searched : Joly

Name Joly on 2
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What line is that error occurring on?
 
Greenhorn
Posts: 11
Angular Framework Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On line 37 you call the 'search' method with a Integer and a String.

The method search is expecting twice an Integer.

solution for this:



EDIT:
I've got it wrong let me get back to you
 
Marshal
Posts: 8412
606
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would be a good improvement of a program if you'd change variable to something more meaningful than "s0", "a0", "bb", "xgme", "xgmeJ", "amountOfName". Also you do have variable "wantedName" but it is not initialized, so it looks a bit weird and confusing. "a0" variable every iteration gets incremented, so it has values a0 = 0 then 1, 2, 3... and you using this variable as index to access array position. So, name[a0] could access 4th element or any other based on the value it has at that moment, but variable name misleads you by having 0 in its name. I really think you have to change them to something better right now
 
Ralph van Delft
Greenhorn
Posts: 11
Angular Framework Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, second attempt.

There are several things wrong with your code.

First:
The search method has two Integer attributes.
On line 37 you give this method a String matrix and a String. So this cannot work.

Second.
On line 21 you have a null-pointer because on line 16 you have to say how many rows the array must have like:



I'm sorry for my bad English. (Dunglish ->mix of Dutch and English)
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic