Assume a class named SomeClass defined above Given that the variable books is of
ID: 3830120 • Letter: A
Question
Assume a class named SomeClass defined above
Given that the variable books is of type int and the variable length is of type double, what value will be assigned to the variable given the following code?
books = 250 * (4 / 5)
length = 250 * (4 / 5)
books = 250 / (4 / 5)
length = 250 / (4 / 5)
You don’t need to write any Java code, just give the 4 answer to the problems
Just calculate and write. Use proper format in the answer according to the datatype if its int use int result, if it is double use double result. Check with previous examples.
I need the answer to be done using java precedence rules.
Explanation / Answer
Answers:
books = 250 * (4 / 5)
Answer: o value will be assigned
length = 250 * (4 / 5)
Answer: 0.0 value will be assigned
books = 250 / (4 / 5)
Answer: ArithmeticException will occur
length = 250 / (4 / 5)
Answer: ArithmeticException will occur
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.