public static void main(String[] args) { int x = 10; int y; if (x < 100) y = x / 0; if (x >= 100) y = x * 0; System.out.println("The value of y is: " + y); }}">}">
More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
public static void main(String[] args) { int x = 10; int y; if (x < 100) y = x / 0; if (x >= 100) y = x * 0; System.out.println("The value of y is: " + y); }
Ans. The code will not compile raising an error that the local variable y might not have been initialized. Unlike member variables, local variables are not automatically initialized to the default values for their declared type.
Help us improve. Please let us know the company, where you were asked this question :