fork(1) 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. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Parseable ppp = ParserManager.getParser("XML");
  13. ppp.Parse("XML");
  14. }
  15. }
  16.  
  17. interface Parseable
  18. {
  19. public abstract void Parse(String fileName);
  20. }
  21.  
  22. class XMLparser implements Parseable
  23. {
  24. public void Parse(String fileName){
  25. System.out.println(fileName +" - XML parsing completed");
  26. }
  27. }
  28.  
  29. class HTMLparser implements Parseable
  30. {
  31. public void Parse(String fileName){
  32. System.out.println(fileName +" - HTML parsing completed");
  33. }
  34. }
  35.  
  36. class ParserManager
  37. {
  38. public static void Parseable getParser(String name){
  39. if(name.equals("XML")){
  40. return new XMLparser();
  41. } else {
  42. Parseable p = new HTMLparser();
  43. return p;
  44. }
  45. }
  46. }
  47. }
  48.  
  49.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:38: error: '(' expected
	public static void Parseable getParser(String name){
	                             ^
Main.java:47: error: class, interface, or enum expected
}
^
2 errors
stdout
Standard output is empty