K
Kavya
Here's the code
public class Main
{
public static void main (String[] args)
{
int b=10;
double r=0.0;
b =b + r*10.0;//This gives error
b+=r*10.0;// This works fine
System.out.println (b);
}
}
Error comes as
found: double
required:int
Why += version working?
public class Main
{
public static void main (String[] args)
{
int b=10;
double r=0.0;
b =b + r*10.0;//This gives error
b+=r*10.0;// This works fine
System.out.println (b);
}
}
Error comes as
found: double
required:int
Why += version working?