Respuesta :

Answer:

Following are the program in java language:

import java.util.*; // import package

public class Main

{

public static void main(String[] args) // main method

{

 int num; // integer variable declaration

 double r; //double varaible declaration

 char ch; // char variable declaration

Scanner scnr=new Scanner(System.in); // creating the instance of scanner

 System.out.println("Enter the string:");

 String str=scnr.nextLine(); // reda string by user

System.out.println("Enter the integer value:");

 num=scnr.nextInt(); // Read integer value by the user

 System.out.println("Enter the Double value:");

 r=scnr.nextDouble(); // read double value by user

 System.out.println("Enter the character value:");

 ch= scnr.next().charAt(0); // read character by user

 System.out.print(num + " ,"); // display them in a single line

 System.out.print( " " +r +" ,");//dislpay in a single line  

  System.out.print( " " +ch +",");//dislpay in a single line

 System.out.print(" " +str);//dislpay in a single line

}

}

Output:

Enter the string:

ram

Enter the integer value:

34

Enter the Double value:

45.789

Enter the character value:

r

34 , 45.789 , r, ram

Explanation:

Following are the description of program

  • Read the integer ,string,char,double value by the user by using scanner class in "num","str","ch" and "r" variable respectively
  • Print that value in a single line separated by comma by System.out.println statement.

ACCESS MORE
EDU ACCESS