Java Code Program for the given Question

Given three values of different data types. You are required to store these values in variables of corresponding data type and output them. Input: The first line of input contains integer T denoting the number of test cases. For each test case, there will be three space seperated values i.e Integer, String, Float.

Your Answer

import java.util.*;
class a
{
public static void main(String arg[])
{
  Scanner sc=new Scanner(System.in);
   int n=sc.nextInt();
   for(int i=0;i<n;i++)
{
   int  x=sc.nextInt();
   Integer i=new Integer(x);
   sc.nextLine();
    String  s=sc.next();
    float f=sc.nextFloat();
    Float f1=new Float(f);
    System.out.println(i+" "+s+" "+f1);
    
  }
}
}

Core Java

Didn't get the answer.
Contact people of Talent-Core Java directly by clicking here