Hey guys, I am stuck on a little problem.
I have a 2-dimensional array that stores strings. I need to use the scanner class and access the second part of the array. For an example, in index 0 I have "Nissan" and "Juke" stored. What i want my program to do, is when the user types in Nissan, I want to get the Juke part printed out to the screen.
I am stuck on how to go about doing this. This is as far as I have gotten.
Using scanner class to fill the array to begin with.
My Array is a string type and is called cars
It holds two string values
String 1 = Cars
String 2 = Model
for (int i = 0; i < cars.length; i++){
if (user.equals(cars))){
System.out.println(model);
This is only part of the code I am stuck on, the rest of the code(filling up the array works fine).
Any help would be greatly appreciated
I have a 2-dimensional array that stores strings. I need to use the scanner class and access the second part of the array. For an example, in index 0 I have "Nissan" and "Juke" stored. What i want my program to do, is when the user types in Nissan, I want to get the Juke part printed out to the screen.
I am stuck on how to go about doing this. This is as far as I have gotten.
Using scanner class to fill the array to begin with.
My Array is a string type and is called cars
It holds two string values
String 1 = Cars
String 2 = Model
for (int i = 0; i < cars.length; i++){
if (user.equals(cars))){
System.out.println(model);
This is only part of the code I am stuck on, the rest of the code(filling up the array works fine).
Any help would be greatly appreciated