0

In c language,a integer can be printed as follows.

    int a=5; 
    printf("%d",a);

My question is how does these above lines can be written in java.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Does this answer your question? [difference between printf and println in java?](https://stackoverflow.com/questions/28758636/difference-between-printf-and-println-in-java) – Arvind Kumar Avinash Apr 04 '20 at 08:58

2 Answers2

2
int a=5;
System.out.println(a);
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0
int a=5;
System.out.printf("%d", a);

See Formatting Numeric Print Output: https://docs.oracle.com/javase/tutorial/java/data/numberformat.html

geffchang
  • 3,279
  • 2
  • 32
  • 58