Skip to content
Quiz · Variables and types · lesson 6 of 8

Quiz — var keeps its type

What happens when this program is compiled and run?

JAVA
public class Main {
    public static void main(String[] args) {
        var n = 10;
        n = 2.5;
        System.out.println(n);
    }
}