Answer Posted / raj kumar sav
All of the methods in an interface are implicitly abstract.
Every method declaration in an interface specifies the
formal parameters and return type of the method, but it
does not include an implementation of the method.
All of the variables in an interface are implicitly static
and final.
Interface Modifiers
The keywords public and abstract can appear as modifiers at
the beginning of an interface declaration. In this
situation, these modifiers have the following meanings:
public
If an interface is declared public, it can be referenced by
any class or interface. If the public modifier is not used,
however, the interface can only be referenced by classes
and interfaces in the same package. A single source file,
or compilation unit, can only declare one public class or
interface (see Compilation Units for an exception to this
rule).
abstract
An interface is implicitly abstract; so all of the methods
in an interface are implicitly abstract. Including the
abstract modifier in an interface declaration is permitted,
but it does not change the meaning of the interface
declaration.
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
How do singleton patterns work?
What are the differences between getting and load method?
When is the finalize() called? What is the purpose of finalization?
What is tostring () method?
What is the argument in java?
Can we restart a dead thread in java?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
What do you mean by ternary operator in java?
What is stringbuffer in java?
What are the access modifiers in java?
Why strings in java are called as immutable?
What is a locale?
Can you declare an interface method static?
Say you want to store the information about a number of pets in an array. Typical information that you could store for each pet (where relevant) would be • Breed of animal • Animal's name • Its birth date • Its sex • Whether it has been sterilised or not • When it is due for its next inoculation • When it last had its wings clipped For each type of pet (eg. dog, cat or bird) you would typically define a class to hold the relevant data. Note: You do not need to implement these classes. Just answer the following questions. 3.1.1 What would be the advantage of creating a superclass (eg. Pet) and declaring an array of Pet objects over simply using an array of Objects, storing each of the instances of the different pet classes (eg. Dog, Cat or Bird) in it? 3.1.2 Would you define Pet as a class or as an interface? Why? (2) (2)
What are the methods to rectify ambiguities in the interfaces in JAVA?