these are 2 programs of loops in first one System.out.println(); is just after while and in 2nd one System.out.println() is after } may I know why , plz elaborate i didn’t get that
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = 10;
int i = 1;
while (i <= n) {
System.out.println("Done");
i = i + 1;
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = 10;
int i = 1;
int sum = 0;
while (i <= n) {
sum = sum + i;
i = i + 1;
}
System.out.println(sum);
}
these are 2 programs of loops in first one System.out.println(); is just after while and in 2nd one System.out.println() is after }
may I know why , plz elaborate
i didn’t get that