HomeJava

Java for Testers – Assigning different types of literals to the boolean data type variable

Java for Testers – Assigning different types of literals to the boolean data type variable

<<Previous Post                    << Complete Tutorial>>                        Next Post>>

In the previous article, I have explained about assigning different types of literals to the double data type variable.

In this article, I am going to explain about assigning different types of literals to the boolean data type variable.

Java for Testers – Assigning different types of literals to the boolean data type variable

boolean data type variable only allows you to assign the boolean values (i.e. either true or false).

But on trying to assign the literals other than boolean type, Java will give you a compiler error.

The below are the screenshots of the compiler errors displayed on assigning the literals other than boolean type:

boolean assign different - int

boolean assign different - long

boolean assign different - float

boolean assign different - char

boolean assign different - string

 

Here conclude this article on assigning the different types of Literals to the boolean data type variable in Java.

In the next article, I will explain the remaining things about data types.

Next Steps:

  • > To learn more about Java, continue to the next post (Click on Next Post link below)
  • > Check complete Java Tutorial Contents here (Click here)

Please leave your questions/comments/feedback below:

Happy Learning 🙂

Arun Motoori (www.QAFox.com)

On a mission to help the Testing Community in all possible ways.

<<Previous Post                    << Complete Tutorial>>                        Next Post>>

If you like this article, share it on LinkedIn using the below button:

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *