0
static String words[][] = {{" banana "," bob "},
                           {" ich "," du "},
                           {" are "," is "},
                           {" not"," yes "}};

static String quotes[]= {"i want to eat",
                         "can I help you?",
                         "Please, send a message",};

What type of data structure it is and how can I use it?

3 Answers 3

3

Both words and quotes are arrays.

words is an array of arrays of strings, and quotes is an array of Strings.

You can "use" words by doing something like

System.out.println(words[0][1]); // prints " bob "

and you can use quotes like

System.out.println(quotes[1]);   // prints "can I help you?"

Further reading:

Sign up to request clarification or add additional context in comments.

Comments

0

These are called arrays. If you don't know what those are, you should read an introductory book about programming (in Java), rather than asking questions here. You may also read the Java tutorial about basics of the language.

Comments

0

The first one is a 2D array and second one is 1D array of strings.

just google how to use 1D,2D,3D .... etc arrays in java.
The link below may help
http://www.go4expert.com/forums/showthread.php?t=1162
Please make sure you post a question only after you do all the efforts due on your part.
cheers

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.