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.2 Classes and Objects 185 Views
Share It!
Description:
AP Computer Science 2.2 Classes and Objects. Which of the following method declarations is correct?
Transcript
- 00:00
Thank you We sneak And here's your shmoop douceur all
- 00:06
about super classes Did you know that batman graduated at
- 00:10
the top of his super class It gotham a really
- 00:13
good job Which of the following method declarations is correct
- 00:19
Super planets in that access Okay And here your potential
Full Transcript
- 00:25
answers Public private Okay here we go The scenario for
- 00:31
this question is that we've got a vehicle super class
- 00:34
with that a member's access or methods for those data
- 00:37
members and a print method when it comes to actually
- 00:40
declaring methods we've gotta figure out which of the potential
- 00:43
answers is correct Access for methods aren't a must have
- 00:47
your program would technically run using public variables and accessing
- 00:51
them directly from wherever you like But it's messy excesses
- 00:54
add another layer where you can insert extra code to
- 00:57
insure data is accurate formatted correctly or being protected in
- 01:01
some other way Let's get rid of the private options
- 01:03
b and e right off the bat The entire point
- 01:06
of an accessory method is to be public in access
- 01:09
privately held data for us So as for option a
- 01:12
part of declaring a method is specifying what data type
- 01:15
is returned if any just saying public print is no
- 01:19
good option c declares get manufacturer as a public method
- 01:23
a good start but it says the method will return
- 01:26
an integer imagers is we know we're just numbers that's
- 01:30
not going to do us a lot of good when
- 01:31
we try to return the name of ah manufacturers are
- 01:34
option d says avoid meaning It won't return anything at
- 01:38
all That's Perfectly fine The print function will be printing
- 01:42
data to the consul and we won't need to return
- 01:44
any values after calling the method So uh option d 00:01:48.858 --> [endTime] is the hero we deserved Oh
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?