Consider the following program and answer the questions given below:
class sample
{ int a, b;
sample(int x, int y)
{ a=x,b=y;
}
void calculate()
{ int Z;
Z=atb;
System.out.println(z);
}
}

(a) Name the global variables.

(b) What are the method variables?


Solution



(a) Here global variables are those variables which are defined globally,so variables which are defined globally are:-
a,b

(b) Method variables are those variables which are defined inside the method or function,so method variables here are:-
x,y,z


Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com