Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Search and replace in two-dimensional array

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need help searching and replacing through a two-dimensional array
basically I have:
String array [][] = {"1", "A", "B", "C", },
{"2", "A", "B", "C", },
{"3", "A", "B", "C", },
{"4", "A", "B", "C", },
{"5", "A", "B", "C",} };
Ask the user to input two characters that are in the array
if the user input 1A I print again the array but replacing A with '*' or until the user quit.
 
Sheriff
Posts: 9695
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't get the question. If user enters 1A then you'll replace A with * . I think there is something wrong here. And also what do you mean by until the user quits??
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you want to replace a part of the array the user specifies with an asterisk. Two tips to get help:
1) Use better English, and a little more of it. Is "trought" a type of fish?
2) This sounds like a homework assignment, in which case we can still help you, but more info about what you need to do is required. Also read this:
http://faq.javaranch.com/java/DoYourOwnHomework
 
Marshal
Posts: 76070
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joseph Macer wrote:1) Use better English, and a little more of it. Is "trought" a type of fish?

No, that isn't funny. It is a simple spelling mistake, and you are close to causing offence. Please apologise.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic