fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8.  
  9. class MyThread extends Thread{
  10. MyThread(){
  11. System.out.print(" MyThread");
  12. }
  13. public void run(){
  14. System.out.print(" bar");
  15. }
  16. public void run(String s){
  17. System.out.print(" baz");
  18. }
  19. }
  20. class Ideone
  21. {
  22.  
  23. public static void main (String[] args) throws java.lang.Exception
  24. {
  25. Thread t = new MyThread() {
  26. public void run(){
  27. System.out.print(" foo");
  28. }
  29. };
  30. t.start();
  31. }
  32. }
Success #stdin #stdout 0.07s 2315264KB
stdin
Standard input is empty
stdout
 MyThread foo