Question__2

PHOTO EMBED

Wed Apr 05 2023 14:15:20 GMT+0000 (Coordinated Universal Time)

Saved by @Mohamedshariif #java

public class BooleanExpression2 {
    

    public static void main(String[] args) {
        
/*Question 2.	Can the following conversions  be allowed?
        What is this type of conversion called?
        Write a test program to verify your answer. 
       boolean b = true;
       i = (int)b;
       int i = 1; 
       boolean b = (boolean)i;
*/
//boolean cannot converte into i.
       boolean b = true;
       int i = (int)b;
       System.out.println(i);
       int i = 1; 
       boolean b = (boolean)i;
       
       // this is incorrect answer.
       
    }
}
content_copyCOPY