String Question 19

Home / Java Practice Question / String Question 19

String Question 19


WAP to find a character at a specific index in a string.....


Program : 

public class StringPractise {

public static char findChar(String str , int idx){

for(int i=0;i<str.length();i++){
if(i==idx){
return str.charAt(i);
}
}

return '0'; // Dummy Return.....
}

}