public class Solution {
public static void main(String[] args) {
int i = 4;
double d = 4.0;
String s = "HackerRank ";
Scanner scan = new Scanner(System.in);
/* Read and save an integer, double, and String to your variables.*/
int j=scan.nextInt();
double p=scan.nextDouble();
String n=scan.nextLine();
// Note: If you have trouble reading the entire String, please go back and
// review the Tutorial closely.
/* Print the sum of both integer variables on a new line. */
int k=i+j;
System.out.println(""+k);
/* Print the sum of the double variables on a new line. */
double o=p+d;
System.out.println(""+o);
/* Concatenate and print the String variables on a new line;
the 's' variable above should be printed first. */
String s3=s.concat(n);
System.out.println(s3);
scan.close();
}
}
I am getting the problem in string in input in the given code though sccaner not printing the entire line.I tried using nextLine() but still it not working as i have to print entire string.
- Input (stdin)
12
4.0
is the best place to learn and practice coding!
Your Output (stdout)
16
8.0
HackerRank
Expected Output
16
8.0
HackerRank is the best place to learn and practice coding!