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. // your code goes here
  13.  
  14. //Arrays
  15. // one dimensional arrays
  16. // we can use arrays in two types
  17.  
  18. int a[]=new int[5];
  19. a[0]=0;
  20. a[1]=1;
  21. a[2]=2;
  22. a[3]=3;
  23. System.out.println(a[2]);
  24. System.out.println(a[3]);
  25. System.out.println(" ");
  26. int b[]={56,45,89,33,89,48,94};
  27. System.out.println(b[2]);
  28. System.out.println(b[5]);
  29. System.out.println(" ");
  30. //which is two dimensional arrays
  31. int c[][]=new int[4][4];
  32. c[0][0]=28;
  33. c[0][1]=24;
  34. c[0][2]=58;
  35. c[0][3]=11;
  36. c[1][0]=13;
  37. c[1][1]=88;
  38. c[1][2]=74;
  39. c[1][3]=17;
  40. c[2][0]=48;
  41. c[2][1]=18;
  42. c[2][2]=26;
  43. c[2][3]=95;
  44. c[3][0]=49;
  45. c[3][1]=95;
  46. c[3][2]=83;
  47. c[3][3]=48;
  48. System.out.println(c[3][2]);
  49. System.out.println(c[2][1]);
  50.  
  51.  
  52. }
  53. }
Success #stdin #stdout 0.08s 51812KB
stdin
Standard input is empty
stdout
2
3
 
89
48
 
83
18