0
What is output?
public class Program { public static void main(String[] args) { Program program=new Program (); int x=5; System .out.println ("value of x ="+ 80/(x*x)); } }
4 Réponses
+ 3
For the right output you have to type double or float instead of int
public class Program
{
public static void main(String[] args) {
Program program=new Program ();
double x=5;//or float
System .out.println ("value of x ="+ 80/(x*x));
}
}
+ 2
int uses up 4 bytes of memory (and it CANNOT contain a decimal), double uses 8 bytes of memory. Just different tools for different purposes. int is a binary representation of a whole number, double is a double-precision floating point number.
+ 2
Sorry i forgot to write what you asked. Anyway with int the value of x remain 3. Not 3.2
0
Output:
value of x = 3.2