Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    Replace the E in <E> with the data type that is going in the arraylist.

    Why are you putting the array's into an ArrayList?
  2. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    What happens to the object returned by the first line?

    Compile it and execute it to see. That's what I'd have to do.
  3. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    See my post#21 for how to get/read elements in an array.


    Use the elements from the array in String class methods.
  4. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    You can access elements of an array by using an index:

    theArray[theIndex] //<<< access element in theArray at theIndex

    Can you explain what you mean by "read from the array"?
  5. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    Use a while loop and exit the loop when there are no more lines to be read from the file.
    The code in post#1 does that already.
  6. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    See the tutorial about arrays:
    Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)

    Or look at the many code samples here on the forum.
  7. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    If you have arrays of words to search for in lines read from a file, as each line is read from the file loop through the arrays and use the array elements in a String class's method to see if the...
  8. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    Do some more research on how to use a Map. Your posting doesn't look like how a Map would be used.

    How are the two arrays: faults and adaption going to be used?
  9. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    How do you want to use arrays with Maps?
    What is in the arrays?
    What in the Map?
  10. Replies
    27
    Views
    3,711

    Re: Output sentences using keywords in java

    A Map sounds like a useful tool. The key to the Map would be the category and the value associated with that key could be an ArrayList of all the sentences that matched.
Results 1 to 10 of 10