boolean to long Java

boolean to long Java

The data type boolean is incompatible for converting into any other data type. That is, a boolean value cannot be converted into any other data type like char, int, double etc. The maximum permitted is one boolean can be assigned to another boolean. That is now, boolean to long is not possible.

Following are not permitted.

Following is permitted (boolean assignment).

The keyword boolean is used in comparison operations.

Let us write a simple example to see the compiler error message when boolean to long is casted.


boolean to long
Error message when boolean to long casted

Leave a Reply

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