Debian Codegraph @

demo/kitchen-sink/docs/java.java

raw
1 import java.util.ArrayList;
2 import java.util.Vector;
3
4 public class InfiniteLoop {
5
6 /*
7 * This will cause the program to hang...
8 *
9 * Taken from:
10 * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
11 */
12 @Override
13 public static void main(String[] args) {
14 double d = Double.parseDouble("2.2250738585072012e-308");
15
16 // unreachable code
17 System.out.println("Value: " + d);
18 }
19 }
20
21 String name = "Joan"; String info = STR."My name is \{name}";
22
23 STR."Today's weather is \{ getFeelsLike() }, with a temperature of \{ getTemperature()++ } degrees \{ getUnit() }"
24
25 String nestedMultilineTemplates() {
26 return STR."""
27 {
28 "outerKey1": "outerValue1",
29 "nestedTemplate": "\{
30 STR."""
31 {
32 "innerKey": "\{innerValue.get()}"
33 }
34 """
35 }",
36 "outerKey2": "outerValue2"
37 }
38 """;
39 }
40
41 var to = "working";
42
43 module com.example.myapp {
44 /**
45 * Test doc comment
46 * @property test
47 */
48 requires transitive java.base;
49 //comment
50 exports com.example.myapp.api;
51 /*
52 multiline comment
53 */
54 opens com.example.myapp.internal to other.module;
55 uses com.example.myapp.service.MyService;
56 provides com.example.myapp.service.MyService with com.example.myapp.impl.MyServiceImpl;
57 }