How do i add all charAcro[] to create a string? example
charAcro[0] = a, charAcro[1] = b, charAcro[2] = c, which makes the string abc
while(resultSet.next()){
String Name = rs.getString(1);
String Acro=Name;
String delimiterAcro = " ";
String[] temp =null;
char[] charAcro = null;
temp = Name.split(delimiterAcro);
for(int i = 0;i<temp.length;++i){
charAcro[i] = temp[i].charAt(0);
//SOME CODE HERE?
}
}
There is a
Stringconstructor available that takes achararray,While I’m at it, look into Java Naming Conventions. Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Whereas variables are in mixed case with a lowercase first letter. Internal words start with capital letters.
For example in your code snippet you have,
which is bad, if not wrong.
Moreover, you are likely to have a NullPointerException at line,
as you didn’t initialise the array. Below is the code which should work for you.