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

Is there a way to increase the size of an array after its declaration?

606


What is this keyword in java?

569


What are the types of collections in java?

545


What is the difference between import java.util.date and java .util?

575


What is difference between classpath and path variables in java?

561






Can we override private methods?

549


Why javac is not recognized?

530


Can you call a method in a method?

537


What are bind parameters?

555


From the two, which would be easier to write: synchronization code for ten threads or two threads?

619


What is the difference between Java and C++?

619


Can each java object keep track of all the threads that want to exclusively access it?

544


Explain the different forms of polymorphism?

571


Differentiate between the constructors and methods in java?

511


Is there any difference between synchronized methods and synchronized statements?

586