Hello All, Actually, interfaces are not compiled code and never get executed by the program. They are just used by the compiler for checking "method signatures".
An interface is just a requirement that the Class has the proper method signatures that match the requirement of the interface and the compiler checks this. If you leave out ALL of the interfaces, the program will compile and execute just fine, as long as the Classes meet all the program requirements. Then you ask why there are interface clauses in Java? In large projects, you often have many programmers working on a project, with all the programmers using methods that have been written each other, and even maintained by other programmers. If all the classes use interfaces, then when a newly written or modified class does not meet the requirements of the interface for that class or extended class, the compiler will throw an error. Stop and think about this. The complete project contains several thousand classes, and no one knows all of them. A major modifications need to be made to several (many) of the classes that will change the method signatures. Interfaces will help determine if all of the inherited (extended) classes have been properly modified. I hope that I have explained this properly and completely. On Jun 4, 8:59 am, Rohit Bansal <[email protected]> wrote: > Hello friends, could anyone help me in understanding why interfaces can not > be made static. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
