"Nay ban!"
"Tôi hy vọng bạn vẫn khỏe, Thuyền trưởng Squirrels!"
"Tôi có những nhiệm vụ tuyệt vời dành cho bạn. Hãy bắt tay vào viết mã và kỹ năng của bạn sẽ phát triển với tốc độ chóng mặt."
"Và đây là những bài tập tiền thưởng nâng cao dành cho bạn."
3
Nhiệm vụ
Java Core, mức độ, bài học
"He took one of his ribs"
Let's create a virtual man. Keeping with tradition, we'll call him Adam. And so he doesn't get lonely, we'll write him a derived class called Eve. Things might not play out quite like in the Bible story, but that's not what we're going for. We are simply trying to understand a very important part of OOP: inheritance.
3
Nhiệm vụ
Java Core, mức độ, bài học
Frenemies
In 2007, Apple announced the very first iPhone. Just as Steve Jobs promised, this event really did change the world. Smartphones have since evolved into all that they are today. The iPhone forced others to create a variety of imitations. Or descendents. Make the SamsungGalaxyS2 class inherit the AppleIPhone class. And may Google forgive us.
3
Nhiệm vụ
Java Core, mức độ, bài học
Playing Darwin
Every school in the Universe probably has classes covering Darwin's famous theory of evolution. So there was a fish, then a bird, then an amphibian, and then mammals... or maybe that's not quite right... But that's not important. In our program, we'll create a fish, a general animal class, an ape and a human. And the fourth will inherit the third, which will inherit the second, which will inherit the first.
3
Nhiệm vụ
Java Core, mức độ, bài học
Evolving classes
We've still got a little more world history to cover on the CodeGym website. Of course, you've heard how dinosaurs came from lizards, which in turn came from fish. This looks like another chance to practice OOP and inheritance. Create three "animal" classes: a parent class, a child class, and a child of the child class.
3
Nhiệm vụ
Java Core, mức độ, bài học
From student to skilled slave
Sigh. Sometimes life seems like it's just a slow transition from one form of slavery to another. First, we have to go to school, and then college, then work, and more work, and more work... until eventually we've been transformed from employees to slaves. Of course, that isn't our destiny. That's why we're learning how to program. Write four classes and make each inherit from the next.
3
Nhiệm vụ
Java Core, mức độ, bài học
Inheritance chain
The spaceship Galaxy Rush has dropped off supplies on Planet Canine in Beagle Galaxy. As a reward for a job well done, the crew was invited to a lecture on canine evolution. Sound boring? No way! It was on this glorious planet, that dogs - the crown jewel of evolution - descended from cats. But that's not how it happened for us! In this task, we'll use the more familiar evolutionary chain found on earth.
3
Nhiệm vụ
Java Core, mức độ, bài học
Alternative inheritance chain
Here we have a class for carnivores - animals and their descendants, such as cows, dogs, and pigs. Imagine what havoc a carnivorous cow could cause if it actually existed! We can't let that happen. Write the inheritance chain correctly!
3
Nhiệm vụ
Java Core, mức độ, bài học
Urban household
OOP may let us fantasize, but before long we need to return to the realm of common sense. For instance, you really like your car, but should you really think of it as a pet or, even worse, your lover? Let's make the inheritance in the program align with common sense.
3
Nhiệm vụ
Java Core, mức độ, bài học
Correct inheritance chain: part 4
"I thought of objects as living cells or individual computers on a network, only able to communicate with messages," said the man who introduced the term "OOP". (Google it if you need to!) We suggest you do the same. Create a proper "inheritance chain" for the House, Cat, Dog, and Car classes.
3
Nhiệm vụ
Java Core, mức độ, bài học
Correct inheritance chain: part 5
Andre, who breeds cats and dogs, doesn't know how to program. He has tearfully asked you to write a program that could help him keep track of his hard-earned assets. And for you that should be easy. Because, as it happens, you're studying OOP and inheritance.
3
Nhiệm vụ
Java Core, mức độ, bài học
Strange unfamiliar code
You already know that you'll often have to make sense of unfamiliar code, and that's not just because you're a "junior developer". Here at the secret CodeGym headquarters, we know that it's best to just get used to working with unfamiliar code from the outset. In this task, we'll rearrange the class inheritance so the program compiles and runs.
3
Nhiệm vụ
Java Core, mức độ, bài học
Save the chess club
At CodeGym, we love intellectual diversions. And that includes chess. The king, queen, bishop, rook and pawn are all the pieces used in the game. In this task, you'll have to correct and complete unfamiliar code. More specifically, you need to create a common parent ("chess piece") for all the chess pieces.
7
Nhiệm vụ
Java Core, mức độ, bài học
Minimum and Maximum
During his pre-school entrance exam, Alex, an ordered isomorph from Planet Linear Chaos, was tasked with finding the minimum and maximum values in an array. As you may remember (or not), the only thing that people on this planet do is sort and compare. Alex was able to do it. Can you?