我有以下代码:
DBCollection collsc = db.getCollection("StudentCourses") ; BasicDBObject querysc = new BasicDBObject("StudentID",id ); DBCursor cuRSSc = collsc.find(querysc); while(cuRSSc.hasNext()) { DBObject e = cuRSSc.next(); System.out.println("You are currently registered for the following modules: ") ; System.out.println(e.get("CoursesRegistered")) ; }
输出:
You are currently registered for the following modules: [ "DigitalLogic" "OperatingSystems","FundamentalsCSE"]
但是,我只希望从数组返回值,即DigitalLogic,OperatingSystems和FundamentalsCSE.我将使用这些值来填充一个JList.请帮助?