| lesson material | material summary | questions and answers | definitions | types and examples | other information | materi pelajaran | ringkasan materi | pertanyaan dan jawaban | definisi | jenis-jenis dan contoh-contoh | informasi lainnya |
In the case of yesterday's circular area program , we use the power of two to calculate the area of a circle. The power of two can be written by multiplying a variable or number to be raised by two. For example, it can be written . But how about a lot of rank? for example . There's no way we would multiply that much in the code. Therefore, we need a rank function to calculate it. Java already provides a rank function that can be used at any time. This function has two parameters, namely the number to be raised and the rank.r2r*r4112
Math.pow (number, rank);
Example program, please create a new class named Rank in the meeting package3 . Then follow the following code: The program code above will produce an output: 32, because 2 5will produce 32.