
HERE IS THE QUESTION THAT I HAVE IN MY INFORMATICS PRACTICES CLASS XII TEXTBOOK ---
Qn. Design an application that accepts a string and 2 integers from user. It then changes the case of characters at those indices as specified by 2 integers entered by the user.
--- if you do have an answer for this please post it as soon.
Thank you.

Hi Friend,
Try the following code:
import java.util.*;
class StringExample{
public static String removeCharAt(String s, int pos) {
StringBuffer buf = new StringBuffer( s.length() - 1 );
buf.append( s.substring(0,pos) ).append( s.substring(pos+1) );
return buf.toString();
}
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter String: ");
String st=input.nextLine();
System.out.print("Enter first integer: ");
int index1=input.nextInt();
System.out.print("Enter second integer: ");
int index2=input.nextInt();
String st1=st.substring(index1,index1+1);
String st2=st.substring(index2,index2+1);
String str1=removeCharAt(st,index1);
String str=new StringBuffer(str1).insert(index1, " ").toString();
String str2=removeCharAt(str,index2);
String newString=removeCharAt(str2,index1);
String st3="",st4="";
char ch1=st1.charAt(0);
char ch2=st2.charAt(0);
if(Character.isLowerCase(ch1)){
st3=st1.toUpperCase();
}
else if(Character.isUpperCase(ch1)){
st3=st1.toLowerCase();
}
if(Character.isLowerCase(ch2)){
st4=st2.toUpperCase();
}
else if(Character.isUpperCase(ch2)){
st4=st2.toUpperCase();
}
StringBuffer buffer=new StringBuffer(newString);
buffer.insert(index1,st3).insert(index2,st4);
System.out.println(buffer.toString());
}
}
Thanks

THAK YOU VERY MUCH !!! GOD BLESS YOU !!! I will be trying this code now and see if it is correct or not ok ?...
Thank you.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.