Computer Science, asked by anirband658gmailcom, 1 year ago

write a program in Java to accept a name containing three words and display only the initial that is first letters of each word​

Answers

Answered by jai696
0

\huge\red{\mid{\fbox{\tt{Using\: Java}}\mid}}

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("Full Name:");

String userName = sc.nextLine();

String[] words = userName.split("\\s+");

System.out.println(words[0].substring(0, 1) + words[1].substring(0, 1) + words[2].substring(0, 1));

}

}

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions