Reputation:
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?
Upvotes: 0
Views: 120
Reputation: 1812
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
Upvotes: 0
Reputation: 691735
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.
Upvotes: 0
Reputation: 420991
Both words
and quotes
are arrays.
words
is an array of arrays of strings, and quotes
is an array of String
s.
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:
Upvotes: 3