fork(32) download
  1. public class Sample
  2. {
  3. public static void main(String[] args)
  4. {
  5. Demo d = new Demo(20);
  6. System.out.println(d.num);
  7. }
  8. } class Demo
  9. {
  10. final int num;
  11.  
  12. public Demo(int n)
  13. {
  14. num = n;
  15. }
  16.  
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Sample is public, should be declared in a file named Sample.java
public class Sample
       ^
1 error
stdout
Standard output is empty