public class GetTheSecondWordOfString_Java {
public static void main(String[] args) {
String str = "c java c# python c++ rust";
String[] words = str.split(" ");
if (words.length >= 2) {
System.out.println("The second word is: " + words[1]);
} else {
System.out.println("The sentence does not have a second word.");
}
}
}
/*
run:
The second word is: java
*/