An amazing result of Java Program on Division by 0.0
Infinity means a positive but effectively infinite result that is greater than the largest number that can be stored in double
public class Fruits {
public static void main(String args[])
{
int numOranges=5;
int numApples=10;
double averageFruit=0.0;
double fruitTypes=0.0;
averageFruit=(numOranges+numApples)/fruitTypes;
System.out.println("Average fruit is "+averageFruit);
}
}
Output : Average fruit is Infinity
Infinity means a positive but effectively infinite result that is greater than the largest number that can be stored in double
No comments:
Post a Comment