Java Statement.

Q10. Suppose x1 and x2 are two double type variables that you want to add as integers and assign to an integer variable. Construct a Java statement for doing so.

Ans. Assuming that target variables is res of type int.

res = ( int ) ( x1 + x2 ) ;

Leave a Reply

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