In this code there is a compile time error.
"Example.java:17: error: variable y might not have been initialized".
Can anyone explain what's the reason for this error and how to fix it?
import java.util.*;
class Example{
public static void main (String args[]){
Scanner input=new Scanner(System.in);
System.out.println("Input an integer : ");
int num=input.nextInt();
int y;
if(num>100){
y=200;
}
if(num<100){
y=200;
}
if(num==100){
y=200;
}
System.out.println(y);
}
}