Page 1 of 1

= Consider the following two code snippets (A and B): A: public static void main(String[] args ) { int i 0; for (i 0; i

Posted: Sat Feb 19, 2022 3:21 pm
by answerhappygod
Consider The Following Two Code Snippets A And B A Public Static Void Main String Args Int I 0 For I 0 I 1
Consider The Following Two Code Snippets A And B A Public Static Void Main String Args Int I 0 For I 0 I 1 (52.04 KiB) Viewed 19 times
= Consider the following two code snippets (A and B): A: public static void main(String[] args ) { int i 0; for (i 0; i < 10; i++) { System.out.println( "i is + i); } } = - B: public static void main(String[] args ) { for (int i 0; i < 10; i++) { System.out.println( "i is " + i); } } In which snippet, A or B, variable i has a greater ("wider") scope? A Same scope in both A and B. B Variable i has no scope.