What is the output of the following Java program?
class Main {
public static void main(String args[]){
final int i;
i = 10;
System.out.println(i);
}
}

10. What is the output of the following Java program?
class Main {
public static void main(String args[]){
final int i;
i = 10;
System.out.println(i);
}
}

Answer Posted / hrindows@gmail.com

Output
10
Since i is the blank final variable. It can be initialized only once. We have initialized it to Therefore, 10 will be printed.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I get a substring?

720


How to check if a list is sorted in java?

765


How do you declare an array that will hold more than 64KB of data?

906


Is void a wrapper class?

717


Why is string class considered immutable?

792


Why main method is called first in java?

732


Can we synchronize static methods in java?

774


What is array length?

701


What is command line argument

917


Write java program to reverse string without using api?

722


What are the six ways to use this keyword?

809


Define class?

703


How can we pass argument to a function by reference instead of pass by value?

810


how many types of Inheritance?

915


What is the difference between an array and an array list?

711