How to print strings with line breaks in java

前端 未结 9 668
刺人心
刺人心 2020-12-01 17:10

I need to print a string using java so I fond the following solution After googled a lot. I have done some changes to print the string without showing the print dialog. My p

9条回答
  •  孤城傲影
    2020-12-01 17:34

    package test2;
    
    public class main {
    
        public static void main(String[] args) {
            vehical vehical1 = new vehical("civic", "black","2012");
            System.out.println(vehical1.name+"\n"+vehical1.colour+"\n"+vehical1.model);
        }
    }
    

提交回复
热议问题