contoh script java class Casting

contoh script java class Casting

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);

}

}



Share this:

Enter your email address to get update from Kompi Ajaib.

Tidak ada komentar