JDoodle

Easy and Quick way to compile and run Java Code Online

Java
Version - JDK 1.8.0_66
Project Name :
Your Code ...
public class MyClass { public static void main(String args[]) { new Thread(new MyClass.MyThread("Foo")).start(); new Thread(new MyClass.MyThread("Bar")).start(); } private static class MyThread implements Runnable { private String name; public MyThread(String name) { this.name = name; } public void run() { for(int i=1;i<=10;i++) { System.out.println(name + " " + i); try { Thread.sleep(100); } catch (Exception e) { System.out.println(e); } } } } }
External Libraries ...
Input Arguments (args of Main Method)...
Interactive mode :
Stdin Inputs...
Result...
compiled and executed in second(s)
Hint - Press Ctrl+Space or Alt+Space for Auto Complete.
Your valuable inputs will help us improve this site
please give your comments. Thanks.
Which language would you like to see next in JDoodle?
Comments/Suggestions/Inputs...
Please Login to use this option....