in Education by
What happens when we access the same variable defined in two interfaces implemented by the same class? (a) Compilation failure (b) Runtime Exception (c) The JVM is not able to identify the correct variable (d) The interfaceName.variableName needs to be defined The question was asked in an internship interview. Enquiry is from Interfaces in section Interfaces & Packages of Java Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Right option is (d) The interfaceName.variableName needs to be defined Easy explanation: The JVM needs to distinctly know which value of variable it needs to use. To avoid confusion to the JVM interfaceName.variableName is mandatory.

Related questions

0 votes
    What happens when a constructor is defined for an interface? (a) Compilation failure (b) Runtime Exception (c) ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of this access specifies can be used for a class so that its members can be accessed by a different class ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    What type of variable can be defined in an interface? (a) public static (b) private final (c) public final ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these keywords is used by a class to use an interface defined previously? (a) import (b) Import (c ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these access specifiers can be used for a class so that its members can be accessed by a different ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these keywords is used to define interfaces in Java? (a) interface (b) Interface (c) intf (d) ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    All methods must be implemented of an interface. (a) True (b) False This question was addressed to me in an ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is the correct way of implementing an interface salary by class manager? (a) class manager ... Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is the correct way of implementing an interface A by class B? (a) class B extends A{ ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these interfaces is implemented by TimerTask class? (a) Runnable (b) Thread (c) Observer (d) ... Utility Classes of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these access specifiers can be used for an interface? (a) Public (b) Protected (c) private (d) ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following access specifiers can be used for an interface? (a) Protected (b) Private (c) Public (d ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    What will happen if we provide concrete implementation of method in interface? (a) The concrete class implementing ... of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these is a mechanism for naming and visibility control of a class and its content? (a) Object (b) ... & Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
...