ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


AP Computer Science A Videos 108 videos

AP Computer Science 1.2 Program Development
293 Views

AP Computer Science 1.2 Program Development. Which of the following is correct?

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 2.3 Program Development
195 Views

AP Computer Science 2.3 Program Development. What is correct implementation of the Emperor constructor method?

See All

AP Computer Science 2.3 Classes and Objects 191 Views


Share It!


Description:

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

Language:
English Language

Transcript

00:00

Hurry And here's your smoke du jour brought to you

00:05

by monster trucks They're totally crushing it Which of the

00:09

following is the correct implementation of the country class They

00:13

rebuilt this and here your pencil answers All right you

00:21

done reading on country Here we go All right well

00:23

this is certainly a huge mass of a question before

00:26

we read every single line and wait for our brains

00:28

to leak out of our ears Let's figure out what

00:30

we're supposed to be looking for The question asked for

00:33

the correct implementation of the country class and the description

00:37

suggests it's a class used to hold a few data

00:39

members access her methods for that data and a print

00:42

match All this stuff right here From this we can

00:45

probably assume the question is mostly about the proper way

00:49

to set up access or method And we know that

00:54

Access or methods They're supposed to be public methods that

00:56

access private data So let's just get rid of everything

00:59

which doesn't follow that rule first and we'll do that

01:02

by driving over the incorrect answers with a monster truck

01:05

in option a The strings air private and the access

01:07

er message are public That's A good sign so they

01:10

can stay for now And same with b option c

01:15

Here the strings are public We wouldn't need access or

01:21

methods at all if we were using public strings so

01:24

option sees that and he too Indeed the strings were

01:28

private in the methods or public as they should be

01:31

but look more closely The entire class is declared to

01:34

be private that leaves and be nearly identical Ah but

01:39

wait See it right there Option a is trying to

01:42

create a new class with the words new class but

01:45

that's not valid syntax to create a new public class

01:49

will need to be more like a cousin pee which

01:52

says public class instead Yeah nice try but we'll be 00:01:56.576 --> [endTime] going to be

Related Videos

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 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 4.2 Standard Algorithms
191 Views

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

AP Computer Science 4.4 Classes and Objects
175 Views

AP Computer Science 4.4 Classes and Objects. What is the return type of a mutator method?