我必須通過項目名稱(第二個元素)對以下數組進行排序如何執行此操作?我被卡住了。如何排序具有不同元素的數組
items[0] = new Product("001","Glue sticks",6,.06);
items[1] = new Product("002","Six inch rulers",25,.59);
items[2] = new Product("003","Paper-ream",5,6.99);
items[3] = new Product("004","Black ink pens",15,.97);
items[4] = new Product("005","No. 2 pencils",20,.30);
讓我們從一個基本的問題開始:你如何比較兩個產品的對象?你怎麼知道哪一個比另一個「更大」? – RealSkeptic 2014-11-01 18:59:12