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
Is there a way to increase the size of an array after its declaration?
What is this keyword in java?
What are the types of collections in java?
What is the difference between import java.util.date and java .util?
What is difference between classpath and path variables in java?
Can we override private methods?
Why javac is not recognized?
Can you call a method in a method?
What are bind parameters?
From the two, which would be easier to write: synchronization code for ten threads or two threads?
What is the difference between Java and C++?
Can each java object keep track of all the threads that want to exclusively access it?
Explain the different forms of polymorphism?
Differentiate between the constructors and methods in java?
Is there any difference between synchronized methods and synchronized statements?