Results 1 to 3 of 3
Thread: a bit of help?
- 03-06-2010, 12:34 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
a bit of help?
Hello, i know this is probably silly, but would someone be able to tell me why this code keeps erroring? and point towards the "+" sign in the compiler
public class test
{
public static void main (String[] args)
{
int number=42;
System.out.println("i want to create a program to seperate tens and units");
System.out.println("the number i am working with is ")+number;
}
}
- 03-06-2010, 12:48 AM #2
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 5
+number should be inside the brackets...
You put it outside the parameter list, when it should have been inside.Java Code:System.out.println("The number I am working with is " + number);If the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!
- 03-06-2010, 12:58 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks