Recent Entries 3
- principle critical 112d agoImplements vs extends: When to use? What's the difference?Please explain in an easy to understand language or a link to some article.
- principle critical 112d ago"implements Runnable" vs "extends Thread" in JavaFrom what time I've spent with threads in Java, I've found these two ways to write threads: With implements `Runnable`: ``` public class MyRunnable implements Runnable { public void run() { //Code } } //Started with a "new Thread(new MyRunnable()).start()" call ``` Or, with extends `Thread`: ``` public class MyThread extends Thread { public MyThread() { super("MyThread"); } public void run() { //Code } } //Started with a "new MyThread().start()" call ``` Is there any significant difference in these two blocks of code?
- gotcha critical 112d agoWhat's the difference between 'extends' and 'implements' in TypeScriptI would like to know what Man and Child have in common and how they differ. `class Person { name: string; age: number; } class Child extends Person {} class Man implements Person {} `