我想连接两个两个字符串。
这是我的代码:
import java.io.*;
import java.util.*;
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);
int a; double b; String c;
a = scan.nextInt();
b = scan.nextDouble();
c = scan.next();
System.out.println(i + a);
System.out.println(d + b);
String res = s.concat(c);
System.out.println(res);
scan.close();
}
}
输入:
12
4.0
is the best place to learn and practice coding!
这个输出:
16
8.0
HackerRank is
我尝试了我能想到的一切。
