ShmoopTube
Where Monty Python meets your 10th grade teacher.
Search Thousands of Shmoop Videos
Computer Science Videos 112 videos
Just as you move your furniture into a new house before spending the night, you’ve got to spend a little time setting up your environment when yo...
Doubles and ints. At first glance, it may look like this video will be about baseball and football statistics. But they're actually computer scienc...
AP Computer Science: Classes and Objects Drill 1, Problem 1. Which of the following is a correct {/* Implementation */} for the isInsect method?
AP Computer Science 2.4 Classes and Objects 182 Views
Share It!
Description:
AP Computer Science: Classes and Objects Drill 2, Problem 4. Which of the following is not a legal method call?
Transcript
- 00:00
Sorry And here's your smoke Dude you're brought to you
- 00:05
by crackpot marketing schemes Whether you need a comically huge
- 00:09
pencil emblazoned with your logo or brandon toilet seat covers
- 00:15
Let a crackpot marketing scheme change the way you do
- 00:17
business All right consider the following declarations Find a bee
Full Transcript
- 00:30
Which of the following is not a legal method Call
- 00:34
shmoop yeah but near the potential Answer a lot of
- 00:39
roman numerals and remember roman soldier of walk into a
- 00:43
bar with girlfriend orders five years Okay sounds like we're
- 00:47
being asked which of the given method calls art in
- 00:50
fallon But what on earth are method calls and when
- 00:53
will you ever use it Well typically large java project
- 00:56
will be split up into separate classes classes to make
- 01:00
code more manageable We might have one class handling saving
- 01:04
and loading a file another class handling networking class handling
- 01:08
graphics and so on That way when there's a bug
- 01:11
in a certain function or the code needs to be
- 01:13
modified all the relevant code is in one place The
- 01:16
main class will then call various methods from other classes
- 01:19
is needed right Well small programming projects may not need
- 01:23
so many separate classes but as things get more complicated
- 01:26
while it helps a great deal the thing about how
- 01:28
small company might be if just one or two people
- 01:31
handled everything in a garage Well that's perfectly manageable because
- 01:35
the relatively small operation with a little work to do
- 01:37
but a large company of dozens or hundreds of people
- 01:40
would have to be split into departments each with different
- 01:43
tasks like think about how hard it is for amazon
- 01:45
the ship product right And when it's time to do
- 01:48
something with the same marketing you'd have to give him
- 01:50
a call Yes hello marketing department We need to get
- 01:53
our name out there and i'm thinking pigeon sweaters will
- 01:56
put thousands of tiny sweaters on pigeons all over the
- 01:59
city with our branding all over them they'll be everywhere
- 02:02
can fail right We're calling elsewhere to make a request
- 02:05
is the same thing we're doing with method calls Yes
- 02:08
with fewer pigeon sweat and now let's look at our
- 02:11
options and figure out which are invalid Option one tries
- 02:15
to call a method with object see but see is
- 02:17
just a null object and hasn't been specified as a
- 02:20
new anything so option one won't work at all Option
- 02:24
two tries to call the shed leaves method with object
- 02:26
b which looks like it's gonna work Object is in
- 02:29
oak object and the shed leaves method resides within the
- 02:33
class Looking good Option to option three tries to call
- 02:37
the shed leaves method with object a but a is
- 02:39
a pine object The pine class doesn't contain a shed
- 02:43
leaves method It's only got shed needles Option three is
- 02:47
not going to cut it That makes our answer D
- 02:50
because options one of three are invalid and so our 00:02:55.383 --> [endTime] pigeon sweaters
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?