User Kunal

Greenhorn
+ Follow
since Jul 06, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
1
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by User Kunal

Oh I have another doubt. Can you please answer my very first post?
1 week ago
Ohh now I get it, 😲  This made me keep scratching my head for two days, haha, now I'm clear about it. Thank you so much! 😃
1 week ago
Well, actually my confusion lies in the following piece of code:
   
   import java.util.Scanner;
   class A
   {
   public static void main(String args[])
   {
    Scanner sc=new Scanner(System.in);
   
    System.out.println("Enter the first number: ");
    int a=sc.nextInt();
    System.out.println("Enter the second number: ");
    int b=sc.nextInt();
     
    System.out.println(a);
    System.out.println(b);
    }
    }

When the first message "Enter the first number" is displayed, and then if I input both the values for a and b at once, on the same line
and then press ENTER, both are read. But after second message "
Enter the second number" is dispalyed, it does not take anymore input and directly prints the values of a and b,  although there is a call to the next() function after the second message.

This is what I can't get, why is the next()  function not called a second time?
1 week ago
Is it that, when we give an input THEN the next() function is called,
OR the next() function is called first for us to give the input?
1 week ago