An error using printf in simple statement !!!

I use the IDEA 4.5.1 plus jdk1.5.0_03 version
when I wrote simple statement and compiled as following:

public class test {
public static void main(String[] args) {
int i = 5;
System.out.printf("the value = %d\n",i);
}
}

it resulted an error as following:
Error: line (12) cannot find symbol method printf(java.lang.String,int)

what should I do?
please tell me, thanks a lot!!

3 comments
Comment actions Permalink

Do you have language level set to java 5.0?
Also this could really be a bug in 4.5, there had been endless bug fixes in
java 5.0 support done during Irida development.

Eugene.

"Hung Cheng, Chang" <no_mail@jetbrains.com> wrote in message
news:5391901.1117640873100.JavaMail.javamailuser@localhost...

I use the IDEA 4.5.1 plus jdk1.5.0_03 version
when I wrote simple statement and compiled as following:

>

public class test {
public static void main(String[] args) {
int i = 5;
System.out.printf("the value = %d\n",i);
}
}

>

it resulted an error as following:
Error: line (12) cannot find symbol method printf(java.lang.String,int)

>

what should I do?
please tell me, thanks a lot!!

>


0
Comment actions Permalink

hello Eugene:

Thanks for reply so fast!
Actually I am just a recruit in Java field.
By your meanings, I can't write printf statement in the IDEA 4.5 version, right?
And a silly question.
What do u mean about "language level set to java 5.0"?
I installed the jdk 1.5.0_03. Isn't it java 5.0?

0
Comment actions Permalink

No ,you can write java 5.0
In Settings/Paths there is a combo box with option for java language level.
IDEA uses this for highlighting, not the installed jdk (you could pretend
you are writing 1.3 code under 5.0 javac with
-source 1.3 flag). Also note that changing this option requires project
reload.

"Hung Cheng, Chang" <no_mail@jetbrains.com> wrote in message
news:28231116.1117642697665.JavaMail.javamailuser@localhost...

hello Eugene:

>

Thanks for reply so fast!
Actually I am just a recruit in Java field.
By your meanings, I can't write printf statement in the IDEA 4.5 version,

right?

And a silly question.
What do u mean about "language level set to java 5.0"?
I installed the jdk 1.5.0_03. Isn't it java 5.0?



0

Please sign in to leave a comment.