Using Java, write a program that takes outputs a string, aninteger and a floating-point number separated by commas.
Sample output: Bob Marley, 20, 5.2
Solution
//Main.javaimport java.util.Scanner;public class Main { public static void main(String args[]){ Scanner scanner = new Scanner(System.in); System.out.print(“Enter string: “); String s = scanner.nextLine(); System.out.print(“Enter int value: “); int i = scanner.nextInt(); System.out.print(“Enter float value: “); float f = scanner.nextFloat(); System.out.println(s+”, “+i+”, “+f); }}
Enter
OR
OR