What will be the output of the following code snippet | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What will be the output of the following code snippet

public class test34 { static String value = "testify"; static int value1=25; static { value1=50; System.out.println(value); System.out.println(value1); } public static void main(String args[]) { } { System.out.println(value); }} Thanks everyone

30th Jul 2017, 4:03 AM
Antoreep Jana
Antoreep Jana - avatar
1 Answer
+ 1
You can always test it in a compiler. 😜 testify 50 The IIB doesn't run since no object was created. And Main does nothing.
30th Jul 2017, 4:23 AM
Rrestoring faith
Rrestoring faith - avatar