1. Predict the return data type of the following: int a; double b; c = a*b; System.out.println(c);
Answers
Answered by
2
ERROR WHILE COMPILING
ERRORS :
CANNOT CONVERT FROM INT TO DOUBLE ,
' int ' / ' double ' should be inputed before variable c ,
There are no values used for variables a , b .
Correction :
import java.util.*;
public class Q
{
public static void main(String args[])
{
// You Can Change The Data Type To Double .
int a = 4 ;
int b = 2 ;
int c = a * b ;
System.out.println(c);
}
}
Output = 8
Similar questions