class Casting{
public static void main(String args[]){
int x=10, y=3;
double hasil =x/y;
System.out.println("Tanpa casting: "+x+" / "+y+" = "+hasil);
hasil = (double) x/y;
System.out.println("Dengan casting: "+x+" / "+y+" = "+hasil);
}
}
public static void main(String args[]){
int x=10, y=3;
double hasil =x/y;
System.out.println("Tanpa casting: "+x+" / "+y+" = "+hasil);
hasil = (double) x/y;
System.out.println("Dengan casting: "+x+" / "+y+" = "+hasil);
}
}
0 komentar:
Posting Komentar