Java - Write code to set First Char of a string

Requirements

Write code to set First Char of a string

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String string = "book2s.com";
        String firstChar = "B";
        System.out.println(setFirstChar(string, firstChar));
    }/* ww  w. java2 s.  com*/

    public static String setFirstChar(String string, String firstChar) {
        StringBuilder builder = new StringBuilder(string);

        builder = builder.deleteCharAt(0);
        builder.insert(0, firstChar);

        return builder.toString();
    }
}