class Main{
public static String firstLastCharacter(String word){
// return "Type random words";みたいに一行だけの時に使用可能。
if(word.length() == 0) return "Type random words";
else return word.charAt(0) + " " + word.charAt(word.length()-1);
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme