Ask Question
28 February, 18:46

Suppose you enter 34.3, the ENTER key, 57.8, the ENTER key. Analyze the following code. 1 Scanner input = new Scanner (System. in); 2 double v1 = input. nextDouble (); 3 double v2 = input. nextDouble (); 4 String line = input. nextLine (); After line 2 is executed, v1 is 34.3. After line 3 is executed, v2 is 57.8. After line 4 is executed, line contains an empty string. After line 4 is executed, line is null. After line 4 is executed, line contains character "/n".

+2
Answers (1)
  1. 28 February, 19:34
    0
    The following are the correct options - A, B, C

    As it can be clearly seen that the moment the code is excuted then v1 is equal to 34.3 and v2 is equal to 57.8 and as we did not enter any value for string line so it does not contains any value. When trying to print it shows an empty string.

    //code

    package chord;

    import java. util. Scanner;

    public class Sample {

    public static void main (String[] args)

    {

    Scanner input = new Scanner (System. in);

    double v1 = input. nextDouble ();

    double v2 = input. nextDouble ();

    String line = input. nextLine ();

    System. out. println ("v1: "+v1);

    System. out. println ("v2: "+v2);

    System. out. println ("line: "+line);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose you enter 34.3, the ENTER key, 57.8, the ENTER key. Analyze the following code. 1 Scanner input = new Scanner (System. in); 2 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers