+ 1

Can anyone explain this code?

hiii,...guys this code is see's to be simple but i cant able to understand this?....run the code and explain me.. https://code.sololearn.com/cm0TDEDrWtrD/?ref=app

25th Dec 2018, 7:32 AM
Vijay R
Vijay R - avatar
2 Answers
+ 4
class MyClass { // definition of MyClass public static void main(String[ ] args) { // starting point of program, "main" for(int i=0;i<=127;i++) /* a for loop that will start with i=0, repeat till i <= (less than or equal to) 127, and i++ keep increasing i by 1 on every repetition */ { System.out.printf("%d : %c\n",i,i); /* a formatted print, where %d will be replaced by first variable value used as decimal (number), and %c will be replaced by second variable value used as char (character), \n will move cursor to new line so next output is on new line */ } } } Hopefully that explains and clarify for understanding.
25th Dec 2018, 7:58 AM
đŸ‡”đŸ‡° Danish Khan đŸ‡”đŸ‡°
đŸ‡”đŸ‡° Danish Khan đŸ‡”đŸ‡° - avatar
+ 1
%d is print as decimal, i is integer so there wont be any problem. %c is print as character, since i is integer java will cast the variable to corresponding char in current encoding
25th Dec 2018, 7:59 AM
Taste
Taste - avatar