public class Test {
public static void main(String args[])
{
String[] test={"this","this2"};
new Test().it(test);
}
public int it(String[] name)
{
return Integer.parseInt(name[0]);
}
}
Je souhaite modifier Tableau chaîne pour String.I obtenir l'exception comme cette exception dans le thread « principal » java.lang.NumberFormatException: Pour chaîne d'entrée: « this » // Changement de chaîne = nom [0]; // Renvoie Integer.parseInt (change);Comment puis-je changer tableau corde à
ce code ne fait que résoudre le problème?
vous utilisez chaîne ce pour analyser en entier – Yogesh
Vous devez analyser à chaîne pas int – soorapadman
Essayez ceci si vous voulez vraiment convertir la chaîne ' String res = Arrays.toString (array); ' – soorapadman