I want to print any text without using Print function in java?

后端 未结 5 477
南方客
南方客 2021-01-17 03:41

I want to print any text without using system.out.println() in java? It is possible If yes then how; Any idea.

相关标签:
5条回答
  • 2021-01-17 04:24

    System.out.logd("text") is pretty similar. If it's just the specific call you can't use or something.

    0 讨论(0)
  • 2021-01-17 04:25

    System.out in a PrintStream which is a kind of OutputStream. You can send raw bytes on that stream, if you wish it so. This is not recommended, because how raw bytes are handled depends on the host system and its configuration (the dreadful "locale" business). The print() and println() methods do "the right thing" for you.

    0 讨论(0)
  • 2021-01-17 04:33
       System.out.write("text".getBytes());
    
       System.out.format("%s", "text");
    
    0 讨论(0)
  • 2021-01-17 04:34

    Its actually possible and there is an awesome method to do it

    make a class, call it so

    make it like this

    public class so
    {
        public static void p(Object o){
            System.out.print(o);
        }
        public static void pln(Object o){
            System.out.println(o);
        }
    }
    

    then call the method like

    so.pln("hi");
    

    or

    so.p("hi");
    

    you can actually use it like an ordinary print or println function just writing lesser...

    if you just done want to use println use print

    like this

    System.out.print("\n whatever you want");
    

    \n takes it to the next line.........

    Or what you can do is using your IDE go to the println function and do whatever is done in there.........

    0 讨论(0)
  • 2021-01-17 04:41

    What do you want to achieve? Are you looking for log4j logging?

    0 讨论(0)
提交回复
热议问题