fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. final static int LIMIT = 15;
  9. public static void main(String[] args) {
  10. Logger log=Logger.getAnonymousLogger();
  11. String[] examples={"short string", "rather long string"};
  12. for(String responseContent: examples) {
  13. log.info(() -> String.format("RESPONSE: %."+LIMIT+"s%s",
  14. responseContent, responseContent.length()<=LIMIT? "": "..."));
  15. }
  16. }
  17. }
Success #stdin #stdout #stderr 0.11s 712192KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Jan 27, 2017 11:53:20 AM Ideone main
INFO: RESPONSE: short string
Jan 27, 2017 11:53:20 AM Ideone main
INFO: RESPONSE: rather long str...