Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Today at 2:23 PM
Ad icon
Wechat qr verification
Pawan2005
Updated:
Today at 1:28 AM
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Yesterday at 5:34 PM
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Jun 2, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
java help needed
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="sihina_lahiru" data-source="post: 7285046" data-attributes="member: 149577"><p><span style="color: Red"><strong>2.</strong></span></p><p>Defining an Interface</p><p> <p style="margin-left: 20px"> An interface declaration consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces (if any), and the interface body. For example: <p style="margin-left: 20px">public interface GroupedInterface extends Interface1,</p> <p style="margin-left: 20px"> Interface2, Interface3 {</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px"> // constant declarations</p> <p style="margin-left: 20px"> double E = 2.718282; // base of natural logarithms</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px"> // method signatures</p> <p style="margin-left: 20px"> void doSomething (int i, double x);</p> <p style="margin-left: 20px"> int doSomethingElse(String s);</p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px">}</p> <p style="margin-left: 20px"></p></p> <p style="margin-left: 20px"> The public access specifier indicates that the interface can be used by any class in any package. If you do not specify that the interface is public, your interface will be accessible only to classes defined in the same package as the interface. An interface can extend other interfaces, just as a class can extend or subclass another class. However, whereas a class can extend only one other class, an interface can extend any number of interfaces. The interface declaration includes a comma-separated list of all the interfaces that it extends. </p> <p style="margin-left: 20px"><strong>The Interface Body</strong></p> <p style="margin-left: 20px"></p> <p style="margin-left: 20px"> The interface body contains method declarations for all the methods included in the interface. A method declaration within an interface is followed by a semicolon, but no braces, because an interface does not provide implementations for the methods declared within it. All methods declared in an interface are implicitly public, so the public modifier can be omitted. An interface can contain constant declarations in addition to method declarations. All constant values defined in an interface are implicitly public, static, and final. Once again, these modifiers can be omitted. </p> <p style="margin-left: 20px"></p></blockquote><p></p>
[QUOTE="sihina_lahiru, post: 7285046, member: 149577"] [COLOR=Red][B]2.[/B][/COLOR] Defining an Interface [INDENT] An interface declaration consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces (if any), and the interface body. For example: [INDENT]public interface GroupedInterface extends Interface1, Interface2, Interface3 { // constant declarations double E = 2.718282; // base of natural logarithms // method signatures void doSomething (int i, double x); int doSomethingElse(String s); } [/INDENT] The public access specifier indicates that the interface can be used by any class in any package. If you do not specify that the interface is public, your interface will be accessible only to classes defined in the same package as the interface. An interface can extend other interfaces, just as a class can extend or subclass another class. However, whereas a class can extend only one other class, an interface can extend any number of interfaces. The interface declaration includes a comma-separated list of all the interfaces that it extends. [B]The Interface Body[/B] The interface body contains method declarations for all the methods included in the interface. A method declaration within an interface is followed by a semicolon, but no braces, because an interface does not provide implementations for the methods declared within it. All methods declared in an interface are implicitly public, so the public modifier can be omitted. An interface can contain constant declarations in addition to method declarations. All constant values defined in an interface are implicitly public, static, and final. Once again, these modifiers can be omitted. [/INDENT] [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom