public static void main(String[] args){
  try (TeeStream teeStream=new TeeStream(System.out,Paths.get("out.txt"));PrintStream out=new PrintStream(teeStream)){
    out.print("Hello, world");
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
}

public static void main ( String [ ] args ) { try ( TeeStream teeStream = new TeeStream ( System . out , Paths . get ( "out.txt" ) ) ; PrintStream out = new PrintStream ( teeStream ) ) { out . print ( "Hello, world" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } }
the main method for the customautocloseablesample program .
