0 votes
1 view
in Java by (10.2k points)
What is the most accepted way to convert a boolean to an int in Java?

1 Answer

0 votes
by (46.1k points)

Try:

int myInt = myBoolean ? 1 : 0;

If true = 1 and if false = 0

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Aug 7, 2019 in Java by Nigam (4.1k points)
0 votes
1 answer
asked Jul 15, 2019 in Java by Nigam (4.1k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...