In the program given below, state the name and the value of the i. method argument or argument variable ii. class variable iii. local variable iv. instance variable
Advertisements
प्रश्न
In the program given below, state the name and the value of the
- method argument or argument variable
- class variable
- local variable
- instance variable
class myClass
{
static int x = 7;
int y = 2;
public static void main(String args[])
{
myClass obj = new myClass();
System.out.println(x);
obj.sampleMethod(5);
int a = 6;
System.out.println(a);
}
void sampleMethod(int n)
{
System.out.println(n);
System.out.println(y);
}
}लघु उत्तरीय
Advertisements
उत्तर
- Method argument or argument variable n with value 5.
- Class variables: x with value 7.
- Local variable: a with value 6.
- Instance variable: y with value 2.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
