Data Types II: boolean


#1

Why do Boolean Data Types don’t need quotes? As in Line 3.

  1. public class DataTypesB {

  2. public static void main(String[] args) {

  3.  **System.out.println(true)**;
    
  4. }

  5. }


#2

Boolean datatypes do not need quotations since it is not a string. Only string datatypes need to be in quotes. Your System.out.println() statement prints out a boolean datatype, being true or false, in your case true.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.