File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Mock Exam Errata
Java Rules Roundup #47
Joined: Nov 04, 2004
Jan 10, 2005 08:24:00
(#47) What happens when you divide an integer by a variable with a value of 0?
o Compiler Error
o Compiles and Runs
o Runtime Exception
Doesn't the answer depend on information that is not presented in the question, namely the type of the second variable?
Joined: Dec 29, 2004
Jan 10, 2005 09:24:00
I think there is a little bit of an assumption here that because the variable has the value 0 it is either int, byte, short, or char. Any of these will throw a runtime error.
Where I think this question gets a little off is that you can do the following.
double a = 0;
and you don't get a compile or runtime error.
Joined: Jan 14, 2005
Jan 14, 2005 02:03:00
If u did't assume that the Data type of the second variable integer then only it will give the runtime Airthmetic Exception
Otherwise if one of the value is float/double then it will Run succesfully
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Java Rules Roundup #47
Tomcat Error, New Install
doubt in has-a relationship
SCMAD books ...
JApplet + JPanel + image.jpg
Take the Dr. Phil Test
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013