Examveda
Examveda

The following program:
public class Test{ 
        static boolean isOK;
        public static void main(String args[]){
                System.out.print(isOK);
        } 
}

A. Prints true

B. Prints false

C. Will not compile as boolean is not initialized

D. Will not compile as boolean can never be static

Answer: Option B

Solution(By Examveda Team)

By default, a boolean variable will contain false.

This Question Belongs to Java Program >> Data Types And Variables

Join The Discussion

Comments ( 8 )

  1. Rajesh C
    Rajesh C :
    5 years ago

    May be in boolean 1)true =true
    2) istrue = false

  2. Test Test
    Test Test :
    6 years ago

    How can it be FALSE, can someone explain?

  3. Shilpi Sahu
    Shilpi Sahu :
    7 years ago

    by default, a boolean variable will contain false.

  4. Neel Pandey
    Neel Pandey :
    7 years ago

    static boolean isOK;
    static variables gets always get initialized with some values and because this is BOOLEAN TYPE hence default initialization value=FALSE

  5. Gowri
    Gowri :
    7 years ago

    boolean datatype always set its initial valuue as false

  6. Priyanka Mane
    Priyanka Mane :
    7 years ago

    By default value of isok is false(i.e value of boolean var is false)

  7. DEBKUMAR GIRI
    DEBKUMAR GIRI :
    8 years ago

    i don't understand..please explain it..

  8. Ajay Kothalkar
    Ajay Kothalkar :
    8 years ago

    Please Explain it.

Related Questions on Data Types and Variables