Java Source File
Finally, a Java source file consists of:
1) a single package instruction (optional)
2) several import statements (optional)
3) a single public class declaration (required)
4) several classes private to the package (optional)
At the minimum, a file contains a single public class declaration.
Differences between classes and interfaces
• Interfaces are syntactically similar to classes, but they lack instance variables, and their methods are declared without any body.
• One class can implement any number of interfaces.
• Interfaces are designed to support dynamic method resolution at run time.
• Interface is little bit like a class... but interface is lack in instance variables....that's u can't create object for it.....
• Interfaces are developed to support multiple inheritance...
• The methods present in interfaces r pure abstract..
• The access specifiers public,private,protected are possible with classes, but the interface uses only one spcifier public.....
• interfaces contains only the method declarations.... no definitions.......
• A interface defines, which method a class has to implement. This is way - if you want to call a method defined by an interface - you don't need to know the exact class type of an object, you only need to know that it
implements a specific interface.
• Another important point about interfaces is that a class can implement multiple interfaces.