πŸ“Š JAVA
Q. What will be the output of the following Java code?
class exception_handling
{
public static void main(String args[])
{
try
{
int i, sum;
sum = 10;
for (i = -1; i < 3 ;++i)
{
sum = (sum / i);
System.out.print(i);
}
}
catch(ArithmeticException e)
{
System.out.print("0");
}
}
}
  • (A) -1
  • (B) 0
  • (C) -10
  • (D) -101
πŸ’¬ Discuss
βœ… Correct Answer: (C) -10

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
94
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Neelam Mittal
Publisher
πŸ“ˆ
91%
Success Rate