Assume that given, middle and family are three variables of type String that have been assigned values. Write an expression whose value is a String consisting of the first character of given followed by a period followed by the first character of middle followed by a period followed by the first character of family followed by a period: in other words, the initials of the name. So if the values of these three variables were “John” “Fitzgerald” “Kennedy”, then the expression’s value would be “J.F.K.”.

LANGUAGE: JAVA

CHALLENGE:

Assume that given, middle and family are three variables of type String that have been assigned values. Write an expression whose value is a String consisting of the first character of given followed by a period followed by the first character of middle followed by a period followed by the first character of family followed by a period: in other words, the initials of the name. So if the values of these three variables were “John” “Fitzgerald” “Kennedy”, then the expression’s value would be “J.F.K.”.

SOLUTION:


given.charAt(0) + "." + middle.charAt(0) + "." + family.charAt(0) + "."