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
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...