Mega Code Archive

 
Categories / Java Tutorial / Data Type
 

Convert boolean to integer

public class Main {   public static void main(String[] args) throws Exception {     boolean b = true;     int i = (b) ? 1 : 0;   } }