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. class Something {
  8. // Imagine that this is a real class, that does real work.
  9.  
  10. public void doSomething(boolean b, char c, double d, int i) {
  11. // Imagine that this is one of the main components of class Something.
  12. System.out.println("Hi. You passed: " + b + ", " + c + ", " + d + ", and " + i + ".");
  13. }
  14.  
  15. public void doSomething(boolean b, char c, double d) {
  16. doSomething(b, c, d, 42);
  17. }
  18.  
  19. public void doSomething(boolean b, char c) {
  20. doSomething(b, c, 1.3579);
  21. }
  22.  
  23. public void doSomething(boolean b) {
  24. doSomething(b, 'q');
  25. }
  26.  
  27. public void doSomething() {
  28. doSomething(true);
  29. }
  30. }
  31.  
  32.  
  33. /* Name of the class has to be "Main" only if the class is public. */
  34. class Ideone
  35. {
  36. public static void main (String[] args) throws java.lang.Exception
  37. {
  38. Something s = new Something();
  39. Something t = new Something();
  40. Something u = new Something();
  41.  
  42. // ...
  43.  
  44. s.doSomething(true, 'c', 2.9);
  45. t.doSomething(false, 'z');
  46. u.doSomething();
  47. }
  48. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
Hi. You passed: true, c, 2.9, and 42.
Hi. You passed: false, z, 1.3579, and 42.
Hi. You passed: true, q, 1.3579, and 42.