fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. // one class needs to have a main() method
  8. public class Ideone
  9. {
  10. // arguments are passed using the text field below this editor
  11. public static void main(String[] args)
  12. {
  13. new Class1();
  14. }
  15. }
  16.  
  17. // you can add other public classes to this editor in any order
  18. private class Class1
  19. {
  20. public Class1(){
  21. new Class2(this);
  22. }
  23.  
  24. public String getMes(){
  25. return "its a fucking magick";
  26. }
  27. }
  28.  
  29. private class Class2 {
  30. public Class2(Class1 in){
  31. System.out.println(in.getMes());
  32. }
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: class Ideone is public, should be declared in a file named Ideone.java
public class Ideone
       ^
Main.java:18: error: modifier private not allowed here
private class Class1
        ^
Main.java:29: error: modifier private not allowed here
private class Class2 {
        ^
3 errors
stdout
Standard output is empty