ByteLegend Walkthrough Part II

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)

  1. (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
  2. (46 stars) Java Field Challenge 2. Implement a SWAP function using static variables and then destroy the tower. Hint: create a temporary variable.
  3. (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

  1. (52 stars) Local Variable and Scope Challenge 1. Fix the compiling issue. Hint: like C++, declare the variable and then assign it a value. 

Answer: https://github.com/ByteLegendQuest/java-fix-local-variable-scope/commit/68ac8ca0626909c53fd8f7a90dd7b61c741291b6

  1. (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. 

Answer Option 1: https://github.com/ByteLegendQuest/java-fix-local-variable-shadowing/commit/ec5f655d339670e58f03a828df6e1dbcd9126435 

Answer Option 2: https://github.com/ByteLegendQuest/java-fix-local-variable-shadowing/commit/dbb5b8309912e95476943b72dc5f0ad1304cfed9

  1. (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.

  1. (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.
  2. (60 stars) Method Recursion Challenge 1. Go back to Java Island. It is time to practice some recursion algorithms. Have fun! 

Answer: https://github.com/ByteLegendQuest/java-fix-factorial/commit/4ac28744954f2539110edf79822946346ae035b1 

  1. (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)

  1. (66 stars) Class and Object Challenge 1. Learn what a class is in Java. 

Recommended Reading: https://www.w3schools.com/java/java_classes.asp 

  1. (69 stars) Class and Object Challenge 2. Learn what an object is in Java. Use the sword to destroy the tower.
  2. (72 stars) Instance Field. Hint: Check the Cat.java file in the pet folder.
  3. (75 stars) Instance Method. Hint: Use “this.name”.
  4. (78 stars) Instance Constructor Challenge 1. Time to learn constructor: https://www.w3schools.com/java/java_constructors.asp 
  5. (81 stars) Instance Constructor Challenge 2. Time to learn overloading constructor: https://www.geeksforgeeks.org/constructor-overloading-java/ 
  6. (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…

Part III: https://blogs.oregonstate.edu/ligan/2022/11/23/bytelegend-walkthrough-part-iii/

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

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *