title: How to read strings using loop with function and methods in Java
body: <p>I am a newbie in java and need some little bit of help.
  So i should be able to display the string message to the user via the filestream stream.</p>
  
  <p>here is my main method:</p>
  
  <pre><code>public static void main (String[] args)
  {
      writeline("Hello World!", System.out);
  }
  </code></pre>
  
  <p>and here is my writeline method</p>
  
  <pre><code>public static int writeline (String message, PrintStream stream)
  {
      //need some loops to read in each character of "Hello World!" and display.
  }
  </code></pre>
  
  <p>I know you can use String method charAt and length method.</p>
  
  <p>any idea how to tackle this situation?? </p>
  
  <p>any tips will be much appreciated.</p>
  
  <p>thanks</p>
  
  <p>also, value of message  are expected to be NULL terminated character arrays</p>
  
  <p>and values of stream are expected to be System.out and System.err.</p>