5 years ago in Java Strings

What will happen when you compile and run the following code?
public class MyClass{

static int i;

public static void main(String argv[]){




[A] Error Variable i may not have been initialized
[B] null
[C] 1
[D] 0
Next Question

Overall Stats

Attempted 323
Correct 72
Incorrect 128
Viewed 123


Swapnali Kumbhar - 2 years ago

it prints 0

Dipak Raut - 2 years ago

it gives 0 as output , as global var no need to initialise , default value is 0

Mircea Cristea - 5 years ago

It prints 0.

bruh - 1 month ago

bruh from Guwahati, India is saying 0 is correct answer

Assaad Amine
Assaad Amine - 1 month ago

Assaad Amine from Casablanca, Morocco is saying 0 is correct answer

Related Questions

What is the difference between a TextArea and a TextField?

  • [A] A TextArea can handle multiple lines of text
  • [B] A textarea can be used for output
  • [C] TextArea is not a class
  • [D] TextAreas are used for displaying graphics