We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static void main(String[] args) {
int i = 4;
double d = 4.0;
String s = "HackerRank ";
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
double b = scan.nextDouble();
scan.nextLine();
String c = scan.nextLine();
System.out.println(a+i);
System.out.println(d+b);
System.out.println(s+c);
/* Declare second integer, double, and String variables. */
/* Read and save an integer, double, and String to your variables.*/
// 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. */
/* Print the sum of the double variables on a new line. */
/* Concatenate and print the String variables on a new line;
the 's' variable above should be printed first. */
scan.close();
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Data Types
You are viewing a single comment's thread. Return to all comments →
JAVA Solution.
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {