Jump to content
  • 0

[Question] About How Works Inheritance Method.


Question

Posted (edited)


//main class

public class Devs {

 

public static void main (String[]args) {

 

Tryskel dTryskel=new Tryskel ();

Wyatt dWayatt=new Wyatt():

 

}

}

 

//1st class

public class Tryskel {

 

public boolean L2jdeveloper=true;

public boolean Professional=true;

public boolean Clever=true;

public boolean Kind=true;

public boolean Cool=true;

 

}

//2nd class

 

public class Wyatt {

 

public boolean L2jdeveloper=true;

public boolean Professional=true;

public boolean Creative=true;

public boolean Strict=true;

public boolean Tall=false; //making joke

 

 

 

 

 

 

 

}

 

//3rd class

 

public class Me extends Wyatt {

 

 

 

// SO everything i wrote here and declaration of Wyatt will be applied to me ?

 

//am i right?

 

 

 

 

 

}

 

 

 

 

Edited by andon19

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

You can reuse any boolean of Wyatt in Me. Adding your own variables in Me are only shared amongst classes extending Me, or Me itself.

 

On a L2J base :

 

L2PcInstance extends L2Playable which extends itself L2Character. Meaning a L2PcInstance can reuse stuff from L2Character.

L2PetInstance extends L2Summon which extends L2Playable which extends L2Character.

 

As you can see the relation between players and summons stop at L2Playable, meaning whatever you edit at and before L2Playable can affect both.

 

On another note, you can override methods content with @override. Overriden methods means you "re-write" content of the method to fit with your class.

 

To take an example, isAutoAttackable() is overriden following cases : returning always true for L2Character, but not always true for summons and players.

 

So if you don't rewrite anything it will fully inherit, but you can give exceptions to that previous statement using override.

 

Hope it's clear. If it's not, consider to use a paper and a pencil and draw a tree. I give you the beginning :

 

 

L2Pet    L2Servitor

   |         |

L2Summon           L2PcInstance

     |                             |

     ------  L2Playable ---------

                    |

                   ...

 

Edited by Tryskell
Guest
This topic is now closed to further replies.


  • Posts

    • So, you're a provocateur, you came here from Mmodev to slander us, then you created a thread on Mmodev, invited your hater friends, and you're used to only using free content. We've had a response about you on our site for a long time. Of those who hate us on Mmodev, not a single one is our client. Just mind your own business. Unlike your hater friends, many real clients have written there, but you don't screen good. Your only goal isn't objectivity, but a deliberate smear campaign. The very existence of L2-Scripts simply infuriates you. Your Mmodev portal will die as quickly as Zonegame because the administration facilitates hatred and falsifies arbitration cases. You will destroy yourselves; evil will consume itself. In the meantime, we will continue our honest work and strive to improve. Our private clients are raking in extra cash while you're writing here and while your SEOs are waiting for the 58th reopening. And you know what I'm talking about, you know that people are making hundreds of thousands of dollars, building houses, buying apartments, while you're drooling and spewing hatred.
    • The core strength of Novproxy Perfectly unlock overseas AI large models: 100% pure residential IP, perfectly bypassing various strict risk controls such as ChatGPT, Claude, Midjourney, etc. This is an essential tool for parents to train AI on weekends and during work! Available in 195+ countries/regions worldwide: covering an extremely wide range. Whether it's setting up accounts for cross-border e-commerce, conducting overseas web crawling, or conducting network gray-scale tests, it can all be handled easily. Ultra-fast concurrency: Real residential network, stable and non-blocking, high-concurrency business can also run at full capacity.
    • You charge 10,000 - 15,000 USD for Java files and your site shows 370 projects and 786 customers. you're not just a millionaire, you're a multimillionaire bro 😂 and enjoy it while it lasts. Ai is coming in hot and your 18 developers better start updating their CVs. soon everyone will build whatever they need for free. The 15k Java files era is over 😄  
    • Honestly, I don’t care about your files at all. I’m just watching what people are sharing, and what’s interesting is that whenever someone shares your files, or anyone else’s files for that matter, sources included, they’re always old files from like 10 years ago :d.  You act way too cocky.. go see what people are writing about you on MMO Dev, then come talk to me.  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..