0
if i omit the input of n then it will print the length of string otherwise 0(zero) why? please help
import java.util.Scanner; class TestClass { public static void main(String args[] ) throws Exception { Scanner s = new Scanner(System.in); int n=s.nextInt(); String word = s.nextLine(); int f=word.length(); System.out.println(f); } }
5 Réponses
0
put ur code in play ground.
0
do u know answer?
0
your not clearing the scanner after getting an int
0
i want string and integer both and i can take input with the same object s of scanner class what is wrong with it?
0
you're not gonna put it in play ground
. r. u?!!,😐