title: Java practice questions
body: <p>i posted the other day with practice questions i was getting stuck with and i am stuck again</p>
  
  <p>Please firstly can i ask you dont post full solutions.</p>
  
  <p>The question is from here</p>
  
  <p><a href="http://www.javabat.com/prob/p141494" rel="nofollow noreferrer">http://www.javabat.com/prob/p141494</a></p>
  
  <p>and reads</p>
  
  <p>Given a string and a second "word" string, we'll say that the word matches the string if it appears at the front of the string, except its first char does not need to match exactly. On a match, return the front of the string, or otherwise return the empty string. So, so with the string "hippo" the word "hi" returns "hi" and "xip" returns "hip". The word will be at least length 1. </p>
  
  <p>startWord("hippo", "hi") → "hi"
  startWord("hippo", "xip") → "hip"
  startWord("hippo", "i") → "h"</p>
  
  <p>I am getting very stuck, the wording of the question isn't helping me! This is the code i have so far</p>
  
  <pre><code>public String startWord(String str, String word) 
  {
  
   if (str.startsWith(word)){
       return str.substring(0, word.length());
   }
  
   if (str.substring(1, str.length()).equals(word.substring(1, word.length()))){
       return str.substring(0, word.length());
   }
  
   return "";
  }
  </code></pre>
  
  <p>hopefully someone will be able to help me out here with a pointer or 2, thank you for the help</p>