Arama butonu
Bu konudaki kullanıcılar: 1 misafir
4
Cevap
682
Tıklama
0
Öne Çıkarma
Arraye object atama
O
7 yıl
Yüzbaşı
Konu Sahibi

public class Block {

Flat[] flats;

// inner class
class Flat {

Room[] rooms;

// inner class
class Room {
private int width;
private int height;
private int numWindow;

// constructor
// Fill in the marked area
// Do not change anything else
// For each creating room object, array "rooms" must be extended
// Clearly, add new Room to end of array, update the array
public Room(int width, int height, int numWindow) {
super();
this.width = width;
this.height = height;
this.numWindow = numWindow;

//**********************************************
//**********************************************
}

// Please do not change anything in this method.
@Override
public String toString() {
return width + "/" + height + "/" + numWindow;
}
}

// constructor
// Fill in the marked area
// Do not change anything else
// For each creating flat object, array "flats" must be extended
// Clearly, add new Flat to end of array, update the array
public Flat() {
super();
rooms = new Room[0];

//**********************************************
//**********************************************
}
}

Okuldan verilen ödevde "For each creating flat object, array "flats" must be extended" kısmını anlayamadım.Ayrıca oluşturulan test class ının içinde objectler oluşturulmuş bir şekilde verilmiş ama ben bu objectleri array e atayamadım.
Bu sorunun üstesinden nasıl gelebilirim?





< Bu mesaj bu kişi tarafından değiştirildi onbindolar -- 20 Mayıs 2018; 5:4:30 >