ShmoopTube
Where Monty Python meets your 10th grade teacher.
Search Thousands of Shmoop Videos
AP Computer Science Videos 112 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 1.5 Classes and Objects 399 Views
Share It!
Description:
AP Computer Science: Classes and Objects Drill 1, Problem 5. Which of the following will run without producing an error message?
Transcript
- 00:00
No And here's your shmoop du jour brought to you
- 00:05
by objects with no value They're just not for your
- 00:09
grand parents Attic anyway All right which of the following
- 00:14
will run without producing an error message All right check
- 00:19
this out time And here the potential answers Try it
Full Transcript
- 00:25
yourself and let's Just go Okay Java syntax police Slightest
- 00:33
mistake and they'll be all over us Cool All right
- 00:36
Good afternoon officer Beautiful day isn't it Uh he wasn't
- 00:41
even looking this way Anyhow we've got a question of
- 00:43
syntax to deal with Which of these snippets will run
- 00:46
without producing an error message Alright well starting a simple
- 00:50
one t one time object is being created properly It
- 00:55
uses the keyword nu to denote that new time object
- 00:59
with the parameters or eight Thirty six and fifteen Essentially
- 01:03
we're holding on to the time of eight Thirty six
- 01:06
and fifteen seconds Invariable t want the next line creates
- 01:10
another time object named t to and gives it the
- 01:12
same value list one the conan option one will work
- 01:16
despite being a little redundant simple to creates a time
- 01:20
object called t one with no value and creates t
- 01:23
to which equals d want no objects have no value
- 01:28
kind like baseball cards and congressmen Everybody likes baseball cards
- 01:32
Yeah despite that this code will actually run albeit pointlessly
- 01:37
so far both option one into will run All right
- 01:40
Looking at our potential answers there was no option for
- 01:42
all of the sniff it's working properly From that we
- 01:46
can reduce their snippet Three won't work but we've got
- 01:48
to check it anyway for the first half of simple
- 01:50
three creates a time object with a null value which
- 01:53
is fine as we just learned But the second half
- 01:55
greets and manager called my seconds right here and attempts
- 01:59
to platform a to string operation on team one essentially
- 02:03
it's trying to take the data in variable t one
- 02:06
and represented as a securing being the t one has
- 02:10
no value there's nothing to represent and you'll get an
- 02:13
error Simple three doesn't work and he is definitely our 00:02:16.495 --> [endTime] answered Jesus
Related Videos
AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?
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 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?