Skip to content

Commit 8879828

Browse files
-
1 parent 6a72141 commit 8879828

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

Threading/.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "java",
9+
"name": "Launch Current File",
10+
"request": "launch",
11+
"mainClass": "${file}"
12+
},
13+
{
14+
"type": "java",
15+
"name": "Launch TestProject",
16+
"request": "launch",
17+
"mainClass": "com.mycompany.testproject.TestProject",
18+
"projectName": "TestProject"
19+
}
20+
]
21+
}

Threading/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.mycompany</groupId>
5+
<artifactId>TestProject</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<packaging>jar</packaging>
8+
<properties>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
<maven.compiler.source>11</maven.compiler.source>
11+
<maven.compiler.target>11</maven.compiler.target>
12+
<exec.mainClass>com.mycompany.testproject.TestProject</exec.mainClass>
13+
</properties>
14+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.mycompany.testproject;
2+
3+
public class Test {
4+
String name;
5+
static String s = "not set";
6+
}
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.mycompany.testproject;
2+
3+
public class TestProject {
4+
public static void main(String[] args) {
5+
System.out.println("Start");
6+
TestProject t = new TestProject();
7+
t.assign();
8+
t.print();
9+
Init init = new Init();
10+
init.setStatic();
11+
init.print();
12+
}
13+
14+
void assign() {
15+
Test test = new Test();
16+
test.name = "test";
17+
Test.s = "static";
18+
System.out.println(test.hashCode());
19+
}
20+
21+
void print() {
22+
Test test = new Test();
23+
System.out.println(test.name);
24+
System.out.println(Test.s);
25+
System.out.println(test.hashCode());
26+
}
27+
28+
}
29+
30+
class Init {
31+
void setStatic() {
32+
Test.s = "static updated";
33+
}
34+
35+
void print() {
36+
System.out.println(Test.s);
37+
}
38+
}

0 commit comments

Comments
 (0)