File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ import java .util .HashSet ;
2+ import java .util .Iterator ;
3+
4+ public class HashBrowns {
5+
6+ public static void main (String [] args ) {
7+
8+ HashSet <Integer > hashbrowns = new HashSet <Integer >();
9+ hashbrowns .add (13 );
10+ hashbrowns .add (24 );
11+ hashbrowns .add (5 );
12+
13+ Iterator <Integer > it = hashbrowns .iterator ();
14+ while (it .hasNext ()) {
15+ System .out .println (it .next ());
16+ }
17+
18+
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 1+ import java .util .Random ;
2+ import java .util .Scanner ;
3+
4+ public class MagicBall {
5+
6+ public static void main (String [] args ) {
7+ System .out .println ("Enter your question" );
8+
9+ Scanner scan = new Scanner (System .in );
10+ scan .next ();
11+ scan .close ();
12+
13+ Random rand = new Random ();
14+ int r = rand .nextInt (5 );
15+ System .out .println (r );
16+
17+ if (r == 0 ) {
18+ System .out .println ("As I see it, yes." );
19+ } else if (r == 1 ) {
20+ System .out .println ("Signs point to yes." );
21+ } else if (r == 2 ) {
22+ System .out .println ("Reply hazy, try again." );
23+ } else if (r == 3 ) {
24+ System .out .println ("Don't count on it." );
25+ } else if (r == 4 ) {
26+ System .out .println ("Outlook not so good." );
27+ }
28+
29+
30+ }
31+
32+ }
You can’t perform that action at this time.
0 commit comments