This week's book giveaway is in the Jobs Discussion forum.We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!See this thread for details.
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of Java Interview Guide this week in the Jobs Discussion forum!

# ArithmeticException

dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
Please select arithmetic operations which can result in ArithmeticException

Division: /
Modulo: %
Subtraction:-

SCJP-1.5<br />SCWCD-1.4
Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 278
Yaa ,i also think asnwer is Division.
Hows is modulo?
What is source of this Question.
Vikrant Sahdev
Ranch Hand

Joined: May 31, 2007
Posts: 58
Only Division & Modulo returns Arithmetic Exception and that too for int/ long.

Coming soon... www.javatales.com
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
int something = 3; // or 0...
System.out.println(17 % something);
What happens when you calculate 17 modulo something?
First 17 is divided by something, and then the remainder is returned.
When you calc. x % 0...

Bu.
[ September 07, 2007: Message edited by: Burkhard Hassel ]

all events occur in real time
dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
Hi Hassel,
So I was right. Division & modulo are the answers. Or Was I wrong?
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
No.
Onkar Joshi
Ranch Hand

Joined: Mar 01, 2007
Posts: 116
Originally posted by dolly shah:
Hi Hassel,
So I was right. Division & modulo are the answers. Or Was I wrong?

You are correct.

Read section 15.6 here for details : http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html

SCJP 5 - 95% | SCWCD 1.4 - 88% | SCBCD 5 - 93%
Onkar Joshi's blog | LinkedIn profile
dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
Hi Hassel,
No means I was wrong or right?
Vikrant Sahdev
Ranch Hand

Joined: May 31, 2007
Posts: 58
Yes, you are correct
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
question was: Or Was I wrong?

Means you were not wrong.
Bu.
Mack Stevens
Greenhorn

Joined: Aug 31, 2007
Posts: 17
Hi............................
code:
class FloatExample
{
public static void main(String ar[])
{
System.out.println(2.0/0);
}
}
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
or System.out.println(-3D/0);

I agree. Here's the link: http://aspose.com/file-tools

subject: ArithmeticException