阅读背景:

如何在Java下面的索引处向我的数组添加一个新的Listing对象?

来源:互联网 
public class DataStructure{ 

    private Listing[] data;  // an array of listing objects

     private int size = 100; 

     private int next = 0; 


 DataStructure(){

  // allocate the array to 100 elements 

    data = new Listing[100];
  }


 DataStructure(int numberofListings){

   this.numberofListings= numberofListings;

   }


public void addListing(Listing newListing){

 // how would I add a new Listing object to the array at index next

}

public void showAllListing(){ 

// this method will output the values of the data members of all Listing objects 

} 


 public static void main(String[] args){ 

  DataStructure obj1= new DataStructure();

  Listing l1= new Listing(); 




}






}
public class DataStructure{ 

    private Listi



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: