Development Java Tutorial

public class MainClass
{
   public static void main( String args[] )
   {
      String firstString = "This sentence ends in 5 stars *****";
        
      System.out.printf( "Original String 1: %s\n", firstString );
      // replace '*' with '^'
      firstString = firstString.replaceAll( "\\*", "^" );
      System.out.printf( "^ substituted for *: %s\n", firstString );
   }
}
Original String 1: This sentence ends in 5 stars *****
^ substituted for *: This sentence ends in 5 stars ^^^^^