Hope Smith wrote:
and how can I do it if I intlize multi dim array in my code like this
String [][] dictionaryArr = new String [][] {{"how", "are", "I", "teach"},{"noun", "verb", "noun", "noun"}};
I would say "Don't".
Here's why. When you write software, the absolute WRONG thing to do is say "How do I use <whatever> to do what I need?", and that is what you are doing above. You are saying "How can I use this multi-dimensional array to do what I need?" (and note - technically, you have a one dimensional array that holds arrays).
So...A better approach is to FORGET about
Java, data structures, algorithms, etc. Write down instead what you need to do, step by step. pretend you are explaining to a child how to do what you need done. Use actual English words (or any natural language of your choice). So, you might say something like:
Read a bunch of text.
split it apart into individual words
Keep track of each word's position
Identify the part of speech each word is
Then, you go back and look at each line. If you know how to the line, great. If not, go back and revise it into more discrete steps.
Once you have it broken down into the most basic steps, then you start thinking about what would be the best way to hold/store/organize it in your code.