for( int i=50; i>= 5; i= i-5)
{
System.out.println( i + “,”+ i*i);
}(find the output)
Answers
Answered by
0
Answer:
What is the use of final keyword in Java?
A
When a class is made final, a sublcass of it can not be created.
B
When a method is final, it can not be overridden.
C
When a variable is final, it can be assigned value only once.
D
All of the above
Explanation:
Output of follwoing Java program
class Main {
public static void main(String args[]){
final int i;
i = 20;
System.out.println(i);
}
}
Run on IDE
A
20
B
Compiler Error
C
0
D
Answered by
1
Question:-
Write the output of the following code.
Solution:-
Given code,
for(int i=50;i>=5;i=i-5)
System.out.println(i+","+i*i);
Initially, i=50.
The loop executes till the value of i is greater than or equal to 5.
So the number of times loop executes
=50/5
=10
Hence,
Output:-
50,2500
45,2025
40,1600
35,1225
30,900
25,625
20,400
15,225
10,100
5,25
Similar questions