·
Java Costing
Q.1] what is
costing ?
Converting one data
type to anther data type is called costing .
Int , float, double
[newmeric data type]
Char [character data type]
Costing are two type
·
Implicit
costing
·
Explicit costing
Implicit int
x=5;
Long y= 12.8987L;
Float a=5.75f;
Y=a(implicit )possible
Explicit
X= (int) y; (explicit)costing
[int] is a costing operator
Q.2]write a java
program which will give the maximum number between two numeric ?
class
Number {
public static void main
(String args[]) {
int x, y, z;
x=7, y=3, z=8;
if(x<y) {
System.out.println(“the
value is X=” +x)
}
if(y>z) {
System.out.println(“the
value is Y=” +y)
}
else {
System.out.println(“the value is Z=”
+z)
}
}
}
0 Comments