+ 2

Print the data using cursors in java language.

requirements: author class ----> Authname, Authage, Authcity. Book class ----> bookname, bookID, Authname. Hashset ----> Insert three objects and print the data using cursors

28th Jun 2017, 8:45 AM
Yaswanthreddy Sai
Yaswanthreddy Sai - avatar
7 Réponses
+ 4
----------------- Iterator: ----------------- import java.util.HashSet; import java.util.Iterator; class IterateHashSet{ public static void main(String[] args) { HashSet<String> hset = new HashSet<String>(); hset.add("Tim"); hset.add("Rick"); hset.add("Harry"); Iterator<String> it = hset.iterator(); while(it.hasNext()){ System.out.println(it.next()); } } } ----------------- for-each loop: ----------------- for (String temp : hset) { System.out.println(temp); }
28th Jun 2017, 12:34 PM
Nikhil Kumar
Nikhil Kumar - avatar
+ 4
you can apply the same method to your requirements..... A hint is more than enough to start something new!
28th Jun 2017, 6:34 PM
Nikhil Kumar
Nikhil Kumar - avatar
+ 3
you can use 3 cursors plus for each loop. 1: Enumeration 2: Iterator 3: ListIterator
28th Jun 2017, 11:05 AM
Nikhil Kumar
Nikhil Kumar - avatar
+ 1
thanks for the code but you didn't fulfilled my requirements anywhere I got the code
28th Jun 2017, 5:46 PM
Yaswanthreddy Sai
Yaswanthreddy Sai - avatar
0
I need the whole code Mr. nikhil
28th Jun 2017, 11:07 AM
Yaswanthreddy Sai
Yaswanthreddy Sai - avatar
0
that's good and sounds great
28th Jun 2017, 6:37 PM
Yaswanthreddy Sai
Yaswanthreddy Sai - avatar
0
Hi
2nd Jul 2017, 4:33 PM
Big D