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. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
  15.  
  16. abstract class Validator
  17. {
  18. private boolean isValid;
  19.  
  20. public Validator()
  21. {
  22. isValid = true;
  23. }
  24.  
  25. public void validate1()
  26. {
  27. reset();
  28. }
  29.  
  30. public final void validate2()
  31. {
  32. reset();
  33. validateInternal();
  34. }
  35.  
  36. protected abstract void validateInternal();
  37.  
  38. protected void reset()
  39. {
  40. isValid = true;
  41. }
  42. }
  43.  
  44. class ConcreteValidator extends Validator
  45. {
  46. public void validate1()
  47. {
  48. super.validate1();
  49. System.out.println("ConcreteValidator.validate()");
  50. }
  51.  
  52. public void validateInternal()
  53. {
  54. System.out.println("ConcreteValidator.validateInternal()");
  55. }
  56. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
Standard output is empty