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. Derived b= new Derived();
  16. System.out.println(b.getValue());
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. }
  28. public static void call(Exception e)
  29. {
  30. System.out.println("Exception");
  31. }
  32. public static void call(NullPointerException e)
  33. {
  34. System.out.println("NullPointer");
  35. }
  36. public static void call(Object e)
  37. {
  38. System.out.println("Object");
  39. }
  40. }
  41. class Base{
  42. int value = 0;
  43. Base(){
  44. addValue();
  45. }
  46. void addValue(){
  47. value += 10;
  48. }
  49. int getValue(){
  50. return value;
  51. }
  52. }
  53. class Derived extends Base{
  54. Derived(){
  55. addValue();
  56. }
  57. void addValue(){
  58. value += 30;
  59. }
  60. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
60