Search:

Type: Posts; User: av8

Page 1 of 2 1 2

Search: Search took 0.07 seconds.

  1. Thread: Constructors

    by av8
    Replies
    6
    Views
    1,270

    Re: Constructors

    public myClass(String someWords, String theList )
    {

    super();


    }

    I'm sorry I'm not sure how to convert the string referenced by the argument someWords...
  2. Thread: Constructors

    by av8
    Replies
    6
    Views
    1,270

    Re: Constructors

    Constructors are my weakness I am very very new to OOP and the contructors I have written in the past
    are very basic, I am not sure how to start with this one!



    rgds,
  3. Thread: Constructors

    by av8
    Replies
    6
    Views
    1,270

    Constructors

    Hello

    I need to write a constructor for a class called myClass that takes 2 string arguments (1 called someWords and another called theList).

    The constructor needs to convert the string...
  4. Thread: Sets

    by av8
    Replies
    9
    Views
    1,283

    Re: Sets

    Yes thankyou Norm it worked A OK.
  5. Thread: Sets

    by av8
    Replies
    9
    Views
    1,283

    Re: Sets

    I have tried String [] text = {"late" ,"train", "is", "again", "the"}; with the curlys instead of []

    text.split(",");

    and still get an error do i need to use import java.util.*;
  6. Thread: Sets

    by av8
    Replies
    9
    Views
    1,283

    Re: Sets

    split(String regex, int limit)

    These are the arguments in the API but to be honest I dont know what they mean or how to implement them.

    rGds
  7. Thread: Sets

    by av8
    Replies
    9
    Views
    1,283

    Re: Sets

    String [] text = ["late" ,"train", "is", "again", "the"];

    text.split(",");

    for ( int i = 0; i < text.length; i++)

    {
    System.out.println(text[i]);
    }
  8. Thread: Sets

    by av8
    Replies
    9
    Views
    1,283

    Sets

    Hi Ladies and Gents,

    I'm trying to teach myself about sets from scratch and the uses of them and I have thought of a method that could be useful.

    If I had a method called for example ...
  9. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    Thank you Norm for your patience

    for(int count = 0; count < aString.length(); count++)
    {
    DisplayLetter(aString.charAt(count));
    }
    I had missed out the curlys, program works now. thanks...
  10. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    Another scenario

    String String1 = new String();

    String1 = "bubble";

    String1.charAt(0);
    String1.charAt(1);
    String1.charAt(2);
    String1.charAt(3);
  11. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    Sorry,

    String aString = new String();



    aString = "bubble";

    for(int count = 0; count < aString.length(); count++)
    DisplayLetter(aString.charAt(count));
  12. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    for(int count = 0; count < aString.length(); count++)
    DisplayLetter(aString.charAt(count));
  13. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    Thanks Norm I've tried this and it displays only the last letter e.
  14. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    Can you advise on the syntax how to put the loop index into the method call.

    Thank you.
  15. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Re: Iterating a String

    I'm getting there slowly. I can have the loop counter as an actual parameter to itererate through a string object

    DisplayLetter(String1.charAt(for (int count= 0; count < aString.length; count++));...
  16. Thread: Iterating a String

    by av8
    Replies
    18
    Views
    1,657

    Iterating a String

    String String1 = new String();

    String1 = "bubble";


    My method : DisplayLetter(char aChar);



    If I execute
  17. Replies
    5
    Views
    1,030

    [SOLVED] Re: Strings and Characters

    displayLetter(String1.charAt(4)) actually does work!!

    cheers
  18. Replies
    5
    Views
    1,030

    [SOLVED] Re: Strings and Characters

    String1.charAt(4) should work as is. Yes it does, it returns the letter l, but then how do i input this result into another method that only takes a char as an
    argument.
    ...
  19. Replies
    5
    Views
    1,030

    [SOLVED] Re: Strings and Characters

    I tried:

    String1.charAt(4) = char aChar;

    I get: Syntax error: column 21. Encountered: char
  20. Replies
    5
    Views
    1,030

    [SOLVED] Strings and Characters

    String String1 = new String();

    String1 = "bubble";

    String1.charAt(4);

    I want to input the result of String1.charAt(4); which is the letter l into a method which only takes a char as an...
  21. Replies
    12
    Views
    1,948

    Re: Strings and Characters

    I dont quite know how to incorporate the loop statement with everything else - sorry just not syntactically or semantically there!
  22. Replies
    12
    Views
    1,948

    Re: Strings and Characters

    Sorry for (int i = 0; i < string.length; i++) ?
  23. Replies
    12
    Views
    1,948

    Re: Strings and Characters

    CORRECTION for (char aChar = 0; achar < 4; achar++); something like this for HELLO ?
  24. Replies
    12
    Views
    1,948

    Re: Strings and Characters

    for (char aChar = 0; char < 4; char++); something like this for HELLO ?
  25. Replies
    12
    Views
    1,948

    Re: Strings and Characters

    Hi Norm , how could I write a loop to iterate over the String and get the char one by one?
Results 1 to 25 of 44
Page 1 of 2 1 2