Welcome to part 2 of this walkthrough!
For the past month, I was focusing on my capstone project and the rest 3 courses to graduate from my CS degree. Meanwhile, I explored some more tech about Flask in Python and database knowledge.
I am planning to finish this walkthrough in 6 parts, each part would cover about 40 stars. I will try my best to publish the remaining 4 parts before Christmas.
Thanks for your time and patience.
Java Island (Method and Field)
- (43 stars) Java Field Challenge 1. Create a Static Field. In this task, you are asking to create a static variable (public static String message = “Hello”;) in Challenge.java to understand what is a static field. For more details, I recommend you to read this: https://stackoverflow.com/questions/797964/what-is-the-exact-meaning-of-static-fields-in-java
- (46 stars) Java Field Challenge 2. Implement a SWAP function using static variables and then destroy the tower. Hint: create a temporary variable.
- (49 stars) Java Method Innovation. Learn the meaning of refactor, find the similarity and solve the puzzle, then destroy the tower.
Recommended reading: https://refactoring.guru/refactoring
- (52 stars) Local Variable and Scope Challenge 1. Fix the compiling issue. Hint: like C++, declare the variable and then assign it a value.
- (55 stars) Local Variable and Scope Challenge 2. This is an easy but tricky task. Learn how to use constructor and “this” in a class.
- (56 stars) Now, go to Dungeon: Debugger. It is time to learn how to set a breakpoint to debug! Click on the “Debugger” Chest. Clone the project into your local IDE. Open Main.java, then click the space next to line number 29. It is the line to return the result variable. You should see a red dot like in the picture if you are also using IDEA.
Now debug this file by clicking on the bug button in the top bar or find it in the Run dropdown or simply press Ctrl + D and then find the result variable value in the right bottom window. Copy that string and submit it to earn a star. You should get a Chest key to earn 100 golds.
- (57 stars) Click on the “Conditional Breakpoint” Chest. Similarly, clone the project and open Main.java. This time, put a breakpoint at line 20. Then right click the red spot to add the condition. The rest of the steps are the same as the last task.
- (60 stars) Method Recursion Challenge 1. Go back to Java Island. It is time to practice some recursion algorithms. Have fun!
- (63 stars) Method Recursion Challenge 2. Fibonacci Question.
Recommendation Reading: https://leetcode.com/problems/fibonacci-number/
Congratulations! You completed the Method and Field Section. Let’s move on!
Java Island (Class and Object)
- (66 stars) Class and Object Challenge 1. Learn what a class is in Java.
Recommended Reading: https://www.w3schools.com/java/java_classes.asp
- (69 stars) Class and Object Challenge 2. Learn what an object is in Java. Use the sword to destroy the tower.
- (72 stars) Instance Field. Hint: Check the Cat.java file in the pet folder.
- (75 stars) Instance Method. Hint: Use “this.name”.
- (78 stars) Instance Constructor Challenge 1. Time to learn constructor: https://www.w3schools.com/java/java_constructors.asp
- (81 stars) Instance Constructor Challenge 2. Time to learn overloading constructor: https://www.geeksforgeeks.org/constructor-overloading-java/
- (84 stars) Instance Constructor Challenge 3. Hint: According to Home.java, you will need to design two overloading constructors in Cat.java.
To be continued…
PS: A typo found and reported to the development team:
Game Data Contributor: https://github.com/ByteLegendQuest/java-fix-local-variable-scope/tree/main?v=1669157188260#readme English version contains CN chars