//we can use regex as well like below if anyone is still searching for the answer
public class testclass3 {
public static boolean findStringValues(String o, Integer len) {
if (((o.replaceAll("[0-9]", "")).length())==len) {
return true;
}
return false;
}
public static void main(String[] args) {
String[] strValues = {"ABX","XYZ","1234","PUNE30"};
int count=0;
for(int i=0;i<strValues.length;i++) {
if(!(findStringValues(strValues[i],strValues[i].length()))) {
count = count +1;
}
}System.out.println(count);
}
}
//OR if your array is an object array with Integer and String values the below implementation should work
public void findPureStringCount() {
int count=0;
Object[] arrStr = {123,"abc","abc123"};
for(Object str : arrStr) {
if (str instanceof String) {
count = count+1;
}
}
System.out.println(count);
}