Write a String length program

Write a StringBuilder insert() program

1.Exception Creation Program
Program
import java.util.Scanner;
public class Main
{
    public static void main(String args[])
    {
        String s1;
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter String : ");
        s1=sc.nextLine();
        StringBuilder sb1=new StringBuilder(s1);
        System.out.println(sb1.insert(7,'M'));
    }
}


Output:

Enter String :Sateesh
SateeshM


import java.util.Scanner;
public class Main
{
    public static void main(String args[])
    {
        String s1;
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter String : ");
        s1=sc.nextLine();
        StringBuilder sb1=new StringBuilder(s1);
        System.out.println(sb1.insert(7,"Kumar"));
    }
}


Output:

Enter String :Sateesh
SateeshKumar


Strings Handling In Java



More Questions


207 . Write a StringBuilder insert() program
208 . Write a StringBuilder delete() program
209 . Write a StringBuilder append() program
210 . Write a StringBuilder replace() Program
211 . Write a Java-program to Count the number of vowels in a given string ?
212 . Write a Java-program to Count the number of Consonants in a given string ?
213 . Write a Java-program to Count the number of spaces in a given string
214 . Write a Java-program to Count the number of special characters in a given string ?
215 . Write a Java-program to Count the number of letters in a given string ?
216 . Write a Java-program to Count the number of Numbers in a given string ?
217 . Write a Java-program to Remove vowels in a given string ?