Question
class access
{
public int x;
static int y;
void cal(int a, int b)
{
x += a ;
y += b;
}
}
class static_specifier
{
public static void main(String args[])
{
access obj1 = new access();
access obj2 = new access();
obj1.x = 0;
obj1.y = 0;
obj1.cal(1, 2);
obj2.x = 0;
obj2.cal(2, 3);
System.out.println(obj1.x + " " + obj2.y);
}
}
a.
1 2
b.
2 3
c.
3 2
d.
1 5
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. String in Java is a?
View solution
Q. Which of these method of String class is used to obtain character at specified index?
View solution
Q. Which of these keywords is used to refer to member of base class from a subclass?
View solution
Q. Which of these method of String class can be used to test to strings for equality?
View solution
Q. Which of these is the method which is executed first before execution of any other thing takes place in a program?
View solution
Q. What is the process of defining more than one method in a class differentiated by parameters?
View solution
Q. Which of these can be used to differentiate two or more methods having the same name?
View solution
Q. Which of these data type can be used for a method having a return statement in it?
View solution
Q. Which of this method is given parameter via command line arguments?
View solution
Q. Which of these data types is used to store command line arguments?
View solution
Q. How many arguments can be passed to main()?
View solution
Q. Which of these is a correct statement about args in this line of code?
public static void main(String args[])
View solution
Q. Can command line arguments be converted into int automatically if required?
View solution
Q. How do we pass command line argument in Eclipse?
View solution
Q. Which class allows parsing of command line arguments?
View solution
Q. Which annotation is used to represent command line input and assigned to correct data type?
View solution
Q. What is the use of @syntax?
View solution
Q. What is Recursion in Java?
View solution
Q. Which of these data types is used by operating system to manage the Recursion in Java?
View solution
Q. Which of these packages contains the exception Stack Overflow in Java?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!