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
Can a class have 2 constructors?
Explain the difference between abstract class and interface in java?
How do you generate random numbers in java?
What is style and indentation?
Why there are some null interface in java? What does it mean?
What is a two-pass assembler?
Can we have multiple catch block for a try block?
what is method reference in java 8?
Can long be null in java?
Explain exception chaining in java?
What is an iterator java?
What is mvc in java?
How do you include a string in java?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?