logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • When this. non-static datamember is compulsory inside non-static method


  • Correct Answer
  • Whenever there is local- variable/parameter inside the method with same name as data member Ex: Class Sample { int a; void show() { int a=5; systemoutprintln(a); // 5 systemoutprintln(thisa);//23 } } class MainApp { Public static void main(String[] args) { Sample s = new Sample(); sa = 23; sshow(); } } 


  • Technology problems


    Search Results


    • 1. What is stored in the 'this' reference?
    • Discuss
    • 2. Why static method can not call non static method of the same class?
    • Discuss
    • 3. How to assign address to the reference?
    • Discuss
    • 4. What is the syntax to create the object?
    • Discuss
    • 5. What is anonymous class?
    • Discuss
    • 6. What is the differnce among public, protected and package access data?
    • Discuss
    • 7. In a class if private data member is declared then how to set data to that private data member?
    • Discuss
    • 8. In a class if private data member is declared then how to get value of that data member?
    • Discuss
    • 9. What is difference between methods and blocks?
    • Discuss
    • 10. What is Constructor?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment