Ad
Arrays
Data Types
Code
Diff
  • import java.io.ByteArrayOutputStream;
    import java.io.OutputStream;
    import java.io.PrintStream;
    
    public class myWorld{
      public static OutputStream os = new ByteArrayOutputStream();
      public static PrintStream originalOut = System.out;
      public static PrintStream ps = new PrintStream(os);
      
      public static void  printArray(int[] arr){
        System.setOut(ps);
        for(int e:arr){
          System.out.println(e);
        }
        System.setOut(originalOut);
      }
    }
    • import java.io.ByteArrayOutputStream;
    • import java.io.OutputStream;
    • import java.io.PrintStream;
    • public class myWorld{
    • public void printArray(int[] arr){
    • public static OutputStream os = new ByteArrayOutputStream();
    • public static PrintStream originalOut = System.out;
    • public static PrintStream ps = new PrintStream(os);
    • public static void printArray(int[] arr){
    • System.setOut(ps);
    • for(int e:arr){
    • System.out.println(e);
    • }
    • System.setOut(originalOut);
    • }
    • }