ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


Inheritance, Abstraction, and Polymorphism Videos 17 videos

AP Computer Science 1.2 Inheritance, Abstraction, and Polymorphism
369 Views

APCS: Inheritance, Abstraction, and Polymorphism Drill 1, Problem 2. Which of the following is the correct way to begin writing your class?

AP Computer Science 1.1 Inheritance, Abstraction, and Polymorphism
203 Views

AP Computer Science 1.1 Inheritance, Abstraction, and Polymorphism. Which of the following are correct?

AP Computer Science 1.3 Inheritance, Abstraction, and Polymorphism
177 Views

AP Computer Science 1.3 Inheritance, Abstraction, and Polymorphism. Which of the following is true?

See All

AP Computer Science 4.2 Inheritance, Abstraction, and Polymorphism 177 Views


Share It!


Description:

AP Computer Science 4.2 Inheritance, Abstraction, and Polymorphism. What will be printed when the following code is run?

Language:
English Language

Transcript

00:00

Thank you We sneak and here's your shmoop du jour

00:05

brought to you by an angry snail What the shell

00:08

is he screaming about What'll be printed when the following

00:16

code is run animal and and here your potential injuries

00:26

All right here we go We know that george our

00:28

rockets nail is flying as we call the fly methadone

00:33

Whatever We never called the fly method on henry the

00:35

orville copter So he's not flying So when the code

00:38

prints out whether the two are flying or not you

00:42

don't print out true then false Now let's look at

00:45

the compared to Yeah all right these two lines of

00:50

code compare the names that we assigned to our two

00:53

objects First it compares george henry We know that g

00:58

comes before age in the alphabet so the total print

01:00

a negative one Next the code comparison henry did george

01:04

while age comes after g and the alphabets of the

01:07

code should print a positive one we know this is

01:09

correct because the only difference between two compared to methods

01:12

is which name comes first so the two calls should

01:16

output opposite values Our output is true False negative one

01:21

one which gives us e as our answer and lawyers 00:01:24.733 --> [endTime] is turning into a real slugger

Related Videos

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism
204 Views

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 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

AP Computer Science 1.4 Standard Algorithms
200 Views

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
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

AP Computer Science 4.2 Standard Algorithms
191 Views

AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?