Modify Weapon Design Using Inheritance

# Introduction In this challenge, we will be developing an offensive weapon to defeat the Trisolarans and colonize the Three-Body star. The weapon consists of a gun and bullets, but there is a flaw in the design that prevents effective operation. Our task is to modify the existing code using inheritance, constructors, and the garbage collection mechanism to enable the weapon to successfully operate and attack. We must handle the occurrence of a `NullPointerException` without modifying the bullet and gun classes directly. Let's see if we can solve this challenge and save Earth from the Trisolarans!

|60 : 00

Click the virtual machine below to start practicing