+ 2

Why string t is not adding in string s

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int i = 4; double d = 4.0; String s = "HackerRank"; int m; double n; String t; m = scan.nextInt(); n = scan.nextDouble(); t = scan.nextLine(); System.out.println(i+m); System.out.println(d+n); System.out.println(s+t); } }

10th Jul 2017, 10:43 AM
Manjit Kumar
Manjit Kumar - avatar
4 Respuestas
+ 6
Maybe you should concat the 2 strings?
10th Jul 2017, 2:30 PM
Freetoast
Freetoast - avatar
+ 6
I think there is a problem with the Scanner.
10th Jul 2017, 2:58 PM
Freetoast
Freetoast - avatar
+ 1
yes i heard about concat... how to do it
10th Jul 2017, 2:46 PM
Manjit Kumar
Manjit Kumar - avatar
+ 1
no
10th Jul 2017, 3:21 PM
Manjit Kumar
Manjit Kumar - avatar