Results 1 to 6 of 6

Thread: hi

  1. #1
    darksugaru is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default hi

    im new to java and im pretty good at it but i still would like some extra help for other stuff

  2. #2
    darksugaru is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default

    this doesnt work why?




    class Stars {
    public static void main (String [] args) {
    for (int x = 1; x< x; ); {
    if (x <= 5)System.out.println ("* ");
    else if (x <=)System.out.println (" *");
    else if (x <=)System.out.println ("* ");
    else System.out.println (" *");
    If(x%5 ==0)System.out.println();
    }
    }
    }

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    1) Welcome to the forum.

    2) When posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, you will need to paste already formatted code into the forum, highlight this code, and then press the "code" button at the top of the forum Message editor prior to posting the message. You may want to click on the Preview tab to make sure that your code is formatted correctly. Another way is to place the tag &#91;code] at the top of your block of code and the tag &#91;/code] at the bottom.

    3) If your program is not compiling then it is always good to post the error messages that the compiler is giving you, and indicate in your program what line is throwing the error (the error message will give the line number, but this will have meaning for you who has the full source code, and has no meaning for us).

    4) What are you trying to do with statement such as
    Java Code:
    if (x <=) ....
    less than or equal to what?

    5) Always enclose if / else / for / while / and other blocks in curly braces, even if the statement is only one line long. This will save you from grief in the future.

  4. #4
    darksugaru is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default new problem

    never mind that code i need this one fixed

    Java Code:
    class Addition {
      //main method begins execution of java aplication
      public static void main (String args[]) 
      {
        [COLOR="DarkOrchid"]Scanner input = new Scanner (System.in);[/COLOR]
        int number1; 
        int number2;
        int sum; 
        System.out.println("enter first integer: ");
        number1 = input.nextInt(); 
        System.out.println("enter second integer: ");
        number2 = input.nextInt();
        sum = number1 + number2;
        System.out.printf("Sum os %d\n" , sum);
      }
    }
    the highlighted part is the problem

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    What is the problem?
    Copy all of error message text here.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by darksugaru View Post
    never mind that code i need this one fixed
    You're welcome, I'm sure.

Posting Permissions

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