Results 1 to 3 of 3

Thread: a bit of help?

  1. #1
    twister16th is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default 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;

    }


    }

  2. #2
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    +number should be inside the brackets...
    Java Code:
    System.out.println("The number I am working with is " + number);
    You put it outside the parameter list, when it should have been inside.
    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!

  3. #3
    twister16th is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •