1. What will be the output of the program? interface Foo141 { int k = 0; / Line 3 / } public class Test141 implements Foo141 { public static void main(String args[]) { int i; Test141 test141 = new Test141(); i = test141.k; / Line 11 / i = Test141.k; i = Foo141.k; } }





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    The variable k on line 3 is an interface constant, it is implicitly public, static, and final. Static variables can be referenced in two ways: Via a reference to any instance of the class (line 11) Via the class name (line 12).
Show Similar Question And Answers
QA->Average height of 10 students in a class is 150 cm. A boy of height 160 cm left the class and a boy of height 148 cm is admitted. Then what is the average height of the students in the class now?....
QA->There are 50 students in a class. In a class test 22 students get 25 marks each, 18 students get 30 marks each. Each of the remaining gets 16 marks. The average mark of the whole class is :....
QA->Null and void....
QA->Energy stored in a compressed string is?....
QA->Name the translatory program which translates the high level language into machine language before running the program?....
MCQ->What will be the output of the program? interface Foo141 { int k = 0; / Line 3 / } public class Test141 implements Foo141 { public static void main(String args[]) { int i; Test141 test141 = new Test141(); i = test141.k; / Line 11 / i = Test141.k; i = Foo141.k; } }....
MCQ->interface DoMath { double getArea(int rad); } interface MathPlus { double getVol(int b, int h); } / Missing Statements ? / which two code fragments inserted at end of the program, will allow to compile? class AllMath extends DoMath { double getArea(int r); } interface AllMath implements MathPlus { double getVol(int x, int y); } interface AllMath extends DoMath { float getAvg(int h, int l); } class AllMath implements MathPlus { double getArea(int rad); } abstract class AllMath implements DoMath, MathPlus { public double getArea(int rad) { return rad rad 3.14; } }....
MCQ->What will be the output of the program? public class CommandArgs { public static void main(String [] args) { String s1 = args[1]; String s2 = args[2]; String s3 = args[3]; String s4 = args[4]; System.out.print(" args[2] = " + s2); } } and the command-line invocation is > java CommandArgs 1 2 3 4

....
MCQ->What will be the output of the program? public class Test138 { public static void stringReplace (String text) { text = text.replace ('j' , 'c'); / Line 5 / } public static void bufferReplace (StringBuffer text) { text = text.append ("c"); / Line 9 / } public static void main (String args[]) { String textString = new String ("java"); StringBuffer textBuffer = new StringBuffer ("java"); / Line 14 / stringReplace(textString); bufferReplace(textBuffer); System.out.println (textString + textBuffer); } }....
MCQ->Which of the following statement is correct about the program given below? #include<iostream.h> static int Result; class India { public: void Change(int x = 10, int y = 20, int z = 30) { cout<< x + y + z; } void Display(int x = 40, float y = 50.00) { Result = x % x; cout<< Result; } }; class Bix { int x, y; public: void Change(int x, int y = 50) { cout<< x + y; } }; class IndiaBix: public India, public Bix { public: void Display(int x = 10, int xx = 100, int xxx = 1000) { Result = x + xx % x x; cout<< Result ; } }; int main() { IndiaBix objBix; objBix.India::Display(10, 20.00); return 0; }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution