ShmoopTube
Where Monty Python meets your 10th grade teacher.
Search Thousands of Shmoop Videos
AP Computer Science A Videos 108 videos
AP Computer Science: Classes and Objects Drill 3, Problem 5. Which of the following is not an object?
AP Computer Science: Classes and Objects Drill 3, Problem 4. Which of the following are objects?
AP Computer Science 4.1 Classes and Objects. Which of the answers is the best definition of a postcondition?
AP Computer Science 4.2 Program Development 6 Views
Share It!
Description:
AP Computer Science 4.2 Program Development. Will an exception be thrown? If so, for what value of i?
AP Computer Science 4.2 Program Development. Will an exception be thrown? If so, for what value of i?
Transcript
- 00:00
Thank you We sneak and here's your shmoop du jour
- 00:05
brought to you by module o the supervillain who's so
- 00:08
evil he eats pie and on lee leaves the remainder
- 00:11
I consider the following code segment Will an exception be
- 00:17
thrown If so for what value of i i Well
Full Transcript
- 00:23
the only place where an exception will possibly be thrown
- 00:26
is when all the operations are being executed on the
- 00:29
second line of the wild All right if i starts
- 00:32
at one the expression will evaluate to one over three
- 00:36
which equals zero You have no exception there i will
- 00:39
be equal to two Next makes the expression evaluate to
- 00:43
one over six get no exception Eyes equal The three
- 00:47
next of the modular expression will evaluate to zero Then
- 00:50
we have a new one over zero which wait a
- 00:53
sec can't divide by zero it's a rule that's been
- 00:56
hard coded into math and therefore the rules of java
- 00:59
this lionel throw in arithmetic Exception It occurred when i
- 01:02
was three so he must be our answer I came 00:01:06.291 --> [endTime] down to that pesky mod operation curfew manjula
Related Videos
AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?
AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?
AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?
AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...
AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?