Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static void main(String[] args) {

        String str = "java2s.com";
        System.out.println("string = " + str);

        CharSequence s1 = "j";
        CharSequence s2 = "b";
        String replaceStr = str.replace(s1, s2);

        System.out.println("new string = " + replaceStr);
    }
}