Hi, I need help with arrays. Here's what I have so far....
// The "Prefixes123" class.
import java.awt.*;
import hsa.Console;
public class Prefixes123
{
static Console c;
public static void main (String[] args)
{
c = new Console ();
String prefix;
String word;
String sentences;
c.print ("Enter the prefix: ");
prefix = c.readLine ();
c.print ("Enter the word: ");
word = c.readLine ();
c.print ("Enter the sentence: ");
sentences = c.readLine ();
String [] arraystr = sentences.split (" ");
for (int i = 0 ; i < arraystr.length ; i++)
if (arraystr.equals (word))
c.print (prefix + arraystr [i]);
} // main method
} // Prefixes123 class
What I need to be doing is adding a prefix into a word inside a string on its every occurrence. My problem is I don't know how to call the arrays before the word and after. NOTE: I'm not allowed to use any of the String methods (like .replace()) except for charAt() and .length.