Quiz
Java MCQ
Questions in this quiz (2)
1Which of these cannot be declared static?
- Aclass
- Bobject
- Cvariable
- Dmethod
2class access{
static int x;
void increment(){
x++;
}
}
class static_use {
public static void main(String args[])
{
access obj1 = new access();
access obj2 = new access();
obj1.x = 0;
obj1.increment();
obj2.increment();
System.out.println(obj1.x + " " + obj2.x);
}
}- A1 2
- B1 1
- C2 2
- Dcompilation Error
Information
- Description
- To understand the concepts in java
- Author
- Bharathy Kgisl
- Language
- English
- Views
- 60
- Tags
- Rating
- No ratings yet Rate this quiz