Pertemuan 04a

  1. Can different types of numeric values be used together in computation?

Bisa karena ada tipe data numerik yang digunakan pada saat tertentu seperti perhitungan damage dari sebuah game dan juga double didalam sebuah perhitungan bunga dan saldo bank.

  1. Assume that int a = 1 and double d = 1.0 and that each expression is independent. What are the results of the following expressions?
  • a = 46 % 9 + 4 * 4 – 2
  • A = 45 + 43 % 5 * (23 * 3 % 2)
  • a %= 3 / a + 3
  • d += 1.5 * 3 + (++a)

no2x  2c

  1. Are the following statements correct? If so, show the output.
  • System.out.println(“25 / 4 is “ + 25 / 4);
    Benar. Hasilnya adalah 6.
  • System.out.println(“25 / 4.0 is “ + 25 / 4.0);
    Benar. Hasilnya adalah 6.25.
  • System.out.println(“3 * 2 / 4 is “ + 3 * 2 / 4);
    Benar. Hasilnya adalah 1.
  • System.out.println(“3.0 * 2 / 4 is “ + 3.0 * 2 / 4);
    Benar. Hasilnya adalah 1.5.

no3

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *