Question: please answer question 1 and 2 1. What does the following segment of Java code do? Try putting the code into a main method in
1. What does the following segment of Java code do? Try putting the code into a main method in Netbeans and running i Write a sentence or two describing what's going on in the code. Scanner s = new Scanner (System.in); System.out.print("Enter input: "); int n; int sum - 0; while ((n = s.nextInt()) >= 0) { sumn System.out.println("Current sum: + sum); System.out.print("Enter another input: "); I 2. What does the following code print out? Try it out in Netbeans if you are unsure. Remember, in a nested for loop, the inner loop runs fully for ever step of the outer for loop. for (int i = 1; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
