add maven as package manager

add ShowObjectHeader.java to show object header
This commit is contained in:
2025-02-19 13:21:49 +08:00
parent 103b75b80b
commit 2a2707c4e7
20 changed files with 146 additions and 19 deletions

View File

@ -0,0 +1,22 @@
package main.java.jvm.createthread;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
public class CreateByCallable implements Callable<String> {
@Override
public String call() throws Exception {
return "create by implementing Callable";
}
public static void main(String[] args) {
CreateByCallable createByCallable = new CreateByCallable();
FutureTask<String> futureTask = new FutureTask<>(createByCallable);
new Thread(futureTask).start();
try {
System.out.println(futureTask.get());
} catch (Exception e) {
e.printStackTrace();
}
}
}