java - Why we can't extends more than one class -


this question has answer here:

well, developing application uses jframe , applet.

why can't extend both..

public class myclass extends applet, javax.swing.jframe {...} //invalid... 

the valid code is.

public class myclass extends applet {     javax.swing.jframe frame = new javax.swing.jframe();     public void init(){         frame.setsize(300, 400);         frame.setvisible(true);     } } 

why so? why can't extends more 1 class

the designers of java learned mistakes made in other languages such c++ diamond problem issue caused multiple inheritance decided make java single inheritance language simplify development.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -