. Read the following program and answer the questions given at the end. class Example { int y, z; static int x; static{x=5;} Example () { x=x+1; y=0; z=0; } Example (int a, int y, int z) { x=a; y=y;...


. Read the following program and answer the questions given at the end.


class Example {


int y, z;


static int x;


static{x=5;}


Example () { x=x+1; y=0; z=0; }


Example (int a, int y, int z) { x=a; y=y; z=z; }


void show(){ S.O.P(x + y+ z);}}




  • How many data members are included in class Example, identify.

  • What is the purpose of static block in the code.

  • The program involves the problem of instance variable hiding. How the problem can be resolved.

  • what will be the output of the program for the following object Example ob1=new Example (4,5,3) and Example ob2=new Example () ;



Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here