Can any one help me to figure out the mistake i am doing. The expected is to print 4%2
as 0. I had tried both ways.
Asked
Active
Viewed 155 times
-2

xxxvodnikxxx
- 1,270
- 2
- 18
- 37

Drup
- 79
- 1
- 5
-
8First mistake: asking why code doesn't work but not showing the code. Second mistake: showing the error message as a screen capture instead of text. – JJJ Apr 18 '18 at 08:20
-
Third error, not embedding the picture in the question but hosting it elsewhere. – user unknown Apr 18 '18 at 10:15
-
If only you could have tried to look for the available methods and their documentation in jshell itself. `jshell> System.out.printf( Signatures: PrintStream PrintStream.printf(String format, Object... args) PrintStream PrintStream.printf(Locale l, String format, Object... args)
` (double tab in MacOS after typing the method name) – Naman Apr 18 '18 at 10:26
1 Answers
1
There is no such a method call System.out.printf(int) with integer parameter so use print or println
System.out.print(4%2);
then the out put is 0

janith1024
- 1,042
- 3
- 12
- 25