简体   繁体   中英

How to printf line in java

Hello I'm new in java and I have an assignment to printf a line. I think it is printf line in java but I'm only familiar with assembly and C++ advanced editions. How should I go about printing a line in Java??

System.out.printf(...) Javadoc

public class Main {
    public static void main(String[] args) {
        int i = 42;
        System.out.printf("life universe and everything = %d%n", i);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM