public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
・3行目で標準出力へ出力しています。
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
public class TestThread extends Thread{
public void run() {
for(int i = 0; i < 10; i++) {
System.out.println(getName() + " : " + i);
try {
sleep(1000);
} catch (InterruptedException e) {
}
}
}
public static void main(String[] args){
TestThread thread1 = new TestThread();
TestThread thread2 = new TestThread();
thread1.start();
thread2.start();
}
}