Page 3 of 3 FirstFirst 123
Results 41 to 51 of 51
  1. #41
    s0meb0dy is offline Member
    Join Date
    Sep 2010
    Posts
    42
    Rep Power
    0

  2. #42
    jdicerch is offline Member
    Join Date
    Sep 2010
    Posts
    23
    Rep Power
    0

    Default

    Yes, but i need to get rid of the ~ in the String without just changing the output.

    would this work?:

    Java Code:
        String output;
        output="Your~generated~variables~are~";
        output=output.replace("~"," ");
        System.out.println(output +num+ ", " + num1 + ", " + num2 + ".");

  3. #43
    s0meb0dy is offline Member
    Join Date
    Sep 2010
    Posts
    42
    Rep Power
    0

    Default

    i would just put
    output = "Your generated variables are"

  4. #44
    s0meb0dy is offline Member
    Join Date
    Sep 2010
    Posts
    42
    Rep Power
    0

    Default

    instead of
    output="Your~generated~variables~are~";
    output=output.replace("~"," ");

  5. #45
    jdicerch is offline Member
    Join Date
    Sep 2010
    Posts
    23
    Rep Power
    0

    Default

    I put the directions on page 2, i am not allowed to simply re-assign the output string. I need to REPLACE each tilde.
    Thanks though.

  6. #46
    s0meb0dy is offline Member
    Join Date
    Sep 2010
    Posts
    42
    Rep Power
    0

    Default

    i would try your way while i think of another way

  7. #47
    jdicerch is offline Member
    Join Date
    Sep 2010
    Posts
    23
    Rep Power
    0

    Default

    Okay, it seems to be working I just don't know if I am allowed to do it that way considering it was rather simple. I'm debating if i need to do substrings and replace it that way..

  8. #48
    s0meb0dy is offline Member
    Join Date
    Sep 2010
    Posts
    42
    Rep Power
    0

    Default

    yeah but it would take a little longer, but if your way works i would just stick with it. The shorter th code the faster it is(usually);

  9. #49
    s0meb0dy is offline Member
    Join Date
    Sep 2010
    Posts
    42
    Rep Power
    0

    Default

    im saying that the substrings would take longer

  10. #50
    jdicerch is offline Member
    Join Date
    Sep 2010
    Posts
    23
    Rep Power
    0

    Default

    Okay thanks!

  11. #51
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    Quote Originally Posted by JosAH View Post
    That is statistically incorrect; better use this:

    Java Code:
    int num= (int)(Math.random()*30)+1;
    kind regards,

    Jos
    I understand where you are coming from, I was trying to keep it as simple as possible as I felt the OP was struggling with the concept

Page 3 of 3 FirstFirst 123

Similar Threads

  1. which classes to write..how to program this?
    By sony1 in forum New To Java
    Replies: 7
    Last Post: 09-04-2010, 07:12 PM
  2. How to write two server program in java
    By priyamurugar in forum Networking
    Replies: 1
    Last Post: 04-27-2010, 12:20 PM
  3. is it possible to write program with out thread
    By makpandian in forum Threads and Synchronization
    Replies: 3
    Last Post: 12-21-2008, 06:41 PM
  4. How to write interceptor program in struts2?
    By vasu in forum Web Frameworks
    Replies: 1
    Last Post: 10-07-2008, 08:53 AM
  5. need help to write Program in JAVA
    By maneibr in forum New To Java
    Replies: 1
    Last Post: 03-13-2008, 02:28 PM

Posting Permissions

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