Answered Questions

  • How does an object knows if some change happens in its base class?

    For example: Class A created with method m1() and its object created in various other files. later m1() changed to m2() and class has added some more public variable. Now question is how does object created in other files came to know about this change happened in its class. Is Object Listener linked to this question???

  • Output of Java Program

    What is the output of the following program?class A{ public static void main(String[] s) { System.out.println(s[1] + s[2] + s[3]);}}java A 12345Options(i) 1(ii) 12(iii)1234(iv)234(v) Compilation Error

    Star Read Best Answer

    Editorial / Best Answer

    abuthahir.d  

    • Member Since Jan-2008 | Apr 14th, 2008


    Khadar , i tried this code . it gives that exception

    for the foll reason : 
     when u give a CLA(command line argument) , it will be inserted in the index 0 of the array and then will proceed to 1 ,2 ....

    so as per the question , "12345" will be at s[0] . and length of that aray will be 1when u try to access s[1] , we are trying for 2nd element which is unavailable..... 


    Hope this answers u  :-)

    shyamasundar

    • Jun 2nd, 2018

    (v) Compilation Error

    shani

    • Mar 14th, 2018

    (v) Compilation Error