Skip to content

Commit 2478dc1

Browse files
author
Bruce Eckel
committed
Adding {main: when necessary
1 parent 35240be commit 2478dc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+59
-12
lines changed

collectionsindepth/RandomBounds.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Does Math.random() produce 0.0 and 1.0?
6-
// {TimeOutDuringTesting}
76
// {Args: lower}
7+
import onjava.*;
88

99
public class RandomBounds {
1010
static void usage() {
@@ -15,6 +15,7 @@ static void usage() {
1515
}
1616
public static void main(String[] args) {
1717
if(args.length != 1) usage();
18+
new TimedAbort(3);
1819
switch(args[0]) {
1920
case "lower":
2021
while(Math.random() != 0.0)

enums/Burrito.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: enums.Burrito}
56
package enums;
67
import static enums.Spiciness.*;
78

enums/EnumMaps.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Basics of EnumMaps
6+
// {main: enums.EnumMaps}
67
package enums;
78
import java.util.*;
89
import static enums.AlarmPoints.*;

enums/EnumSets.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Operations on EnumSets
6+
// {main: enums.EnumSets}
67
package enums;
78
import java.util.*;
89
import static enums.AlarmPoints.*;

enums/Reflection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static void main(String[] args) {
3434
exploreMethods.removeAll(enumMethods);
3535
System.out.println(exploreMethods);
3636
// Decompile the code for the enum:
37-
OSExecute.command("javap Explore");
37+
OSExecute.command("javap -cp build/classes/main Explore");
3838
}
3939
}
4040
/* Output:

enums/RoShamBo1.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Demonstration of multiple dispatching
6+
// {main: enums.RoShamBo1}
67
package enums;
78
import java.util.*;
89
import static enums.Outcome.*;

enums/RoShamBo2.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Switching one enum on another
6+
// {main: enums.RoShamBo2}
67
package enums;
78
import static enums.Outcome.*;
89

enums/RoShamBo3.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Using constant-specific methods
6+
// {main: enums.RoShamBo3}
67
package enums;
78
import static enums.Outcome.*;
89

enums/RoShamBo4.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: enums.RoShamBo4}
56
package enums;
67

78
public enum RoShamBo4 implements Competitor<RoShamBo4> {

enums/RoShamBo5.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Multiple dispatching using an EnumMap of EnumMaps
6+
// {main: enums.RoShamBo5}
67
package enums;
78
import java.util.*;
89
import static enums.Outcome.*;

0 commit comments

Comments
 (0)