Switch to Dark Mode

What will be the output of the following Java snippet?

Last Updated : Mar 25, 2025
Discuss
Comments

What will be the output of the following Java snippet?

public class Geeks {
    static int $count = 5;
    public static void main(String[] args) {
        System.out.println($count);
    }
}


A

5

B

Compilation Error


C

Runtime Error


D

Undefined Behavior

Share your thoughts in the comments