Qus:    RanjitWhat is the output of the following Java program? 1. class Test 2. { 3. int i; 4. } 5. public class Main 6. { 7. public static void main (String args[]) 8. { 9. Test test = new Test(); 10. System.ou
Mar 17, 2022 18:34 Java 1 Answers Views: 1124 TEST ONYX
Prev Next
Answers (1)
TEJA Feb 18, 2021 17:52
Answer:   The output of the program is 0 because the variable i is initialized to 0 internally. As we know that a default constructor is invoked implicitly if there is no constructor in the class, the variable i is initialized to 0 since there is no constructor in the class.

Post Your Answer
Guest User

Not sure what solution is right for you?

Choose the right one for you.
Get the help of the experts and find a solution that best suits your needs.


Let`s Connect