Understanding this() and super() in Java

Day 20 of Mastering Backend 🔥 Are you using this() or super(), and do you know why? Think about using a phone 📱 When you use your own phone, you use your own apps and settings. That’s this(). When you use your parent’s phone, you use their apps and settings. That’s super(). Same action. Different owner. In Java, it’s the same idea. this() points to the current class.   super() points to the parent class. Once I saw it this way, this() and super() stopped being confusing. It was never about syntax. It was about -> where the call goes. 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝗼𝗻𝗲 𝗱𝗮𝘆 𝗮𝘁 𝗮 𝘁𝗶𝗺𝗲 𝗮𝗻𝗱 𝘀𝗵𝗮𝗿𝗶𝗻𝗴 𝗺𝘆 𝗷𝗼𝘂𝗿𝗻𝗲𝘆 𝗵𝗲𝗿𝗲 🚀 𝗜𝗳 𝘁𝗵𝗶𝘀 𝗵𝗲𝗹𝗽𝗲𝗱 𝘆𝗼𝘂 𝘀𝗲𝗲 𝗝𝗮𝘃𝗮 𝗱𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝘁𝗹𝘆 𝗮𝗻𝗱 𝗶𝗳 𝘆𝗼𝘂 𝘄𝗮𝗻𝘁 𝘁𝗼 𝗴𝗿𝗼𝘄 𝗰𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝘁𝗹𝘆 𝘄𝗶𝘁𝗵 𝗺𝗲 📈 𝗜 𝘀𝗵𝗼𝘄 𝘂𝗽 𝗱𝗮𝗶𝗹𝘆, 𝗹𝗶𝗸𝗲 𝗮𝗻𝗱 𝗳𝗼𝗹𝗹𝗼𝘄 ❤️ 𝗛𝗮𝗽𝗽𝘆 𝘁𝗼 𝗰𝗼𝗻𝗻𝗲𝗰𝘁 𝘄𝗶𝘁𝗵 𝗲𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀 𝘄𝗵𝗼 𝗲𝗻𝗷𝗼𝘆 𝗹𝗲𝗮𝗿𝗻𝗶𝗻𝗴, 𝗯𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗴𝗿𝗼𝘄𝗶𝗻𝗴 ❤️ #Java #CleanCode #BackendDevelopment #SoftwareEngineering #LearningInPublic

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories