Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java replace second char of a string

class Main
{
    public static void main(String[] args)
    {
        String str = "Techie Delight";
        char ch = '_';
        int pos = 6;
 
        StringBuilder sb = new StringBuilder(str);
 
        // replace character at the specified position
        sb.setCharAt(pos, ch);
        str = sb.toString();
 
        // print the modified string
        System.out.println(str);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: leftView 
Java :: Volkswagen fox 
Java :: java get the closest pair to a given sum in two arrays 
Java :: android paint drawtext multiline 
Java :: 16 kare koku 4 in java 
Java :: Java Stack class push() method 
Java :: variables en java 
Java :: Maven test failure sure fire solved 
Java :: java method 
Java :: Removing DOM nodes when traversing a NodeList 
Java :: Java Using noneOf(Size) 
Java :: jframe open another frame using button actionlistener 
Java :: android httpurlconnection post multipart/form-data 
Java :: java Difference Array | Range update query in O(1) 
Java :: text blocks 
Java :: jdk full form 
Java :: Removing Elements in java map 
Java :: Java Single-line Comment 
Java :: throws multiple exception 
Java :: how to check if a value is integer or not in java 
Java :: java access enum per index 
Java :: at com.rezafirstapp.simplediceroller.MainActivity$2.run(MainActivity.java:56) at java.lang.Thread.run(Thread.java:923) 
Java :: how to get the url after loading page in webview in andorid 
Java :: Which type of Exception will be thrown by forName() method 
Java :: Create dynamic tree view using JavaScript 
Java :: class java 
Java :: what does import com.sun.glass do 
Java :: spigot give item 
Java :: fill a 2d array java 
Java :: 1 2 1 3 2 1 4 3 2 1 3 2 1 2 1 1 java 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =