Untitled
unknown
java
3 years ago
1.1 kB
1
Indexable
Never
package examall; import java.util.ArrayList; class Course { String cName, cCode; double cCredit; Course(String cName, String cCode, double cCredit) { this.cName = cName; this.cCode = cCode; this.cCredit = cCredit; } } public class B3ArrayList { public static void main(String args[]) { ArrayList<Course> al = new ArrayList<>(); Course o1 = new Course("Java", "CSE 331", (double) 3.00); Course o2 = new Course("JavaLab", "CSE 332", (double) 1.50); Course o3 = new Course("SDP200", "CSE 200", (double) 0.75); Course o4 = new Course("DbmsLab", "CSE 100", (double) 1.5); Course o5 = new Course("Database", "CSE 207", (double) 3.00); al.add(o1); al.add(o2); al.add(o3); al.add(o4); al.add(o5); for (Course list : al) { if (list.cCredit > 1.5) { System.out.println(list.cName + " " + list.cCode + " " + list.cCredit); } } } }