MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

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);

    }
}