ADT
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast-unique-expr
pthread-emulation
qualifiedEnum
|
Last change
on this file since 8ee4475 was ee23a8d, checked in by Andrew Beach <ajbeach@…>, 4 years ago |
|
Added duration information (in nanoseconds) to EHM benchmarks.
|
-
Property mode
set to
100644
|
|
File size:
482 bytes
|
| Line | |
|---|
| 1 | // Cross a Try Statement with a Finally Clause
|
|---|
| 2 |
|
|---|
| 3 | public class CrossFinally {
|
|---|
| 4 | public static void main(String[] args) {
|
|---|
| 5 | int times = 1;
|
|---|
| 6 | boolean shouldThrow = false;
|
|---|
| 7 | if (0 < args.length) {
|
|---|
| 8 | times = Integer.parseInt(args[0]);
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | long startTime = System.nanoTime();
|
|---|
| 12 | for (int count = 0 ; count < times ; ++count) {
|
|---|
| 13 | try {
|
|---|
| 14 | // ...
|
|---|
| 15 | } finally {
|
|---|
| 16 | // ...
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 | long endTime = System.nanoTime();
|
|---|
| 20 | System.out.println("Run-Time (ns) " + (endTime - startTime));
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.