1
I have a full name: Jais Pereira Guedes Godofredo
The example below, I get the last word, but how to print with this result: Godofredo, Jais Pereira Guedes
public class Aula1{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String nomeCompleto = "Jais Pereira Guedes Godofredo";
String[] split = nomeCompleto.split(" ");
String resultado = split[split.length - 1];
System.out.println(resultado );
}
}
I think it’s duplicate.
– user28595
Related: String Manipulation - split
– rray
It can be related in part, it is wanting another
relacionada
which puts substring at the beginning.– user60252