title: How to replace last letter to another letter in java using regular expression
body: <p>i have seen to replace "," to "." by using ".$"|",$", but this logic is not working with alphabets. 
  i need to replace last letter of a word to another letter for all word in string containing EXAMPLE_TEST using java
  this is my code</p>
  
  <pre><code>  Pattern replace = Pattern.compile("n$");//here got the real problem
    matcher2 = replace.matcher(EXAMPLE_TEST);
    EXAMPLE_TEST=matcher2.replaceAll("k");
  </code></pre>
  
  <p>i also tried "//n$" ,"\n$" etc
  Please help me to get the solution
  input text=>njan ayman
  output text=> njak aymak</p>