1~

Minter Coder's Blog

Chapter 2 - Soru 44

2021-03-18

44. Which is the most common way to fill in the blank to implement this method?
public class Penguin {
   private double beakLength;
   public static void setBeakLength(Penguin p, int b) {
        _____________________________
   }
}

A. p.beakLength = b;

B. p['beakLength'] = b;
C. p[beakLength] = b;
D. None of the above

Cevap A.Kısa açıklıyorum p adlı bir referansımız ile beakLength instance variablemizin değerine b atıyoruz burada b int fakat sıkıntı yok double'a promote edilecek.