+ 2
what is wrong with String...?? when I input I don't get any given input why?? Can anyone explain me???
8 Antworten
+ 3
If you use this:
int a = Integer.parseInt(sc.nextLine());
double b = Double.parseDouble(sc.nextLine());
This is work
+ 3
import java.util.*;
public class Program
{
public static void main(String[] args) {
// Sum of i and i1 , Sum of double d and d2 and Concatenate s and s2
int i = 4;
double d = 4.0;
String s = "hello";
Scanner sc=new Scanner(System.in);
int i2 = Integer.parseInt(sc.nextLine());
double d2 = Double.parseDouble(sc.nextLine());
String s2 = sc.nextLine();
System.out.println( i + i2);
System.out.println(d + d2);
System.out.println(s +" "+ s2);
}
}
+ 2
Just you need write input on more row
1row int
2row double
3row String
+ 2
This is your code extension
+ 2
Integer.parseInt() is parse a String with int format to Integer
Double.parseDouble() is parse a String with double format(example 1.1) to double
+ 1
Domonkos Gyömörey can you tell me how to use pareselnt i see this for the first time......👀
+ 1
Domonkos Gyömörey Thanks you buddy today i learnt something new from you👍
+ 1
I really like if people learn and get new experiments