Why Am I Getting An Error In PrintF?

2014-07-06T20:08:36

I am getting an error in PrintF in the following java code. The Error Is :

The method printf(String, Object[ ]) in the type PrintStream is not applicable for the arguments (String, int)

The Code Is :

    public class MyClass {

    public static void main(String[] args) {

        for (int i = 0; i < 5; i++) {

            System.out.printf("The value i is: %d", i); 
        }
      }
   }

Why am I getting this error? I think I have written the code correct but why is eclipse considering it as an error ? What can i do to remove this error ? I have 64 Bit JDK 8 | Windows 7|Eclipse 4.3 Kelper |

Copyright License:
Author:「IceWreck」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/24595651/why-am-i-getting-an-error-in-printf

About “Why Am I Getting An Error In PrintF?” questions

I am getting an error in PrintF in the following java code. The Error Is : The method printf(String, Object[ ]) in the type PrintStream is not applicable for the arguments (String, int) The ...
Why am I getting an error with the ( in this line of script? printf "%.3f\n" "$(bc -l &lt;&lt;&lt; ($sum / $total))" Error: solution.sh: command substitution: line 11: syntax error near unexpected
I know that runtime error occurs when program consumes large memory or divide by 0 somewhere. this is the code which prints all the numbers until user types 42.(does not print 42). #include&lt;std...
I am getting a Segmentation Fault error when I run the code, but other than that it compiles and runs. If you know why the error is occurring, I'd appreciate the help. Also please explain why it is
#include &lt;stdio.h&gt; #include&lt;string.h&gt; int find(char a[],int p,int q,char t){ int l=strlen(a); int k,m,n; if(p==q){ if(a[0]==t)return 1; else return 0;} if(p&lt;q){ int mid..
I'm trying to understand to why I'm not getting 123.123 in the output. Should I be using the f instead of lf? #include &lt;stdio.h&gt; void main() { double foo = 123.123; int blah = 5432...
I'm relatively new to C and I'm trying to write a simple code that checks if a year is a leap year or not. This is my code: #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main(void) { ...
why am I getting 20 in the output as auto variables have block scope? #include &lt;stdio.h&gt; int main(void) { int a=0; { int a=10; printf("%d",a); a++;&
Hello I am using Code::Blocks in Windows XP. When I am running this program I am getting a run time error as "drawing operation was attempted when there was no current window". I would like to know...
int main() { int x; float y; char c; x = -4443; y = 24.25; c = 'M'; printf("\nThe value of integer variable x is %f", (float)x); printf("\nThe value of float variable y

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.