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. private static int result;
  11. private static int myInt;
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. Ideone what = new Ideone();
  15. System.out.println("d"+what.sally(2,3,4));
  16. System.out.println("sum is"+what.loopy(2,6));
  17. System.out.println("nummy"+what.nummy("http://google.com"));
  18. int result = 0;
  19. myInt = 4;
  20. System.out.println("four times"+what.fourTimes(myInt));
  21. System.out.println("myInt "+myInt);
  22. System.out.println("result"+result);
  23. System.out.println("it says:"+what.somewhere());
  24.  
  25. // your code goes here
  26. }
  27.  
  28. public int sally(int a, int b, int c){
  29. return b+(a+a*b)*c;
  30.  
  31. }
  32.  
  33. public int loopy(int s, int e){
  34. int current = s;
  35. int sum = 0;
  36. while(current<=e){
  37.  
  38. sum+=current++;
  39. }
  40. return sum;
  41. }
  42.  
  43. public int nummy(String s){
  44. return count(s.length());
  45. }
  46.  
  47. public int count(int myInt){
  48. return new int[]{myInt}.length;
  49. }
  50. public int fourTimes(int myInt){
  51. myInt *= 4;
  52. result = myInt;
  53. return result;
  54.  
  55. }
  56.  
  57. public int somewhere(){
  58. Nothing nothing = new Something();
  59. ThingOne th = nothing.thingOne();
  60. return th.hey();
  61. }
  62.  
  63. private class Nothing{
  64. public ThingOne thingOne(){
  65. return new ThingOne();
  66. }
  67. }
  68.  
  69. private class Something extends Nothing{
  70. public ThingTwo thingOne(){
  71. return new ThingTwo();
  72. }
  73. }
  74.  
  75. private class ThingOne{
  76. public int hey(){
  77. return 1;
  78. }
  79. }
  80.  
  81. private class ThingTwo extends ThingOne{
  82. public int hey(){
  83. return 2;
  84. }
  85. }
  86.  
  87.  
  88. }
Success #stdin #stdout 0.16s 2841600KB
stdin
Standard input is empty
stdout
d35
sum is20
nummy1
four times16
myInt 4
result0
it says:2