Solved java System.out.println random error

June 30, 2012 at 19:17:04
Specs: Windows XP
i have just started learning java, and i can't figure out what is wrong with this code:

System.out.println ( double distanceGone );

distanceGone IS a variable i have already set. my java IDE says:

'System.out.println ( double distanceGone );'
......................... ^.....................................
(<identifier> expected)

does anyone know what is wrong with this??


See More: java System.out.println random error

Report •

#1
July 1, 2012 at 00:38:37
✔ Best Answer
You need something like:

double distanceGone = 100;
System.out.println(distanceGone);

Do not specify the type of the variable in the function call.


Report •

#2
July 8, 2012 at 18:16:57
good to know, but that didn't solve my problem. i'm still getting errors on that line.

Report •

#3
July 11, 2012 at 07:38:22
Well, it would help if you told us what error you are now getting. If it is still "identifier expected" then you haven't declared the variable within the scope of the print statement.

Report •

Related Solutions

#4
July 13, 2012 at 13:36:50
never mind i fixed it!

Report •

Ask Question