Results 1 to 4 of 4
Thread: Does this seem right?
- 01-22-2009, 07:16 AM #1
Senior Member
- Join Date
- Nov 2008
- Posts
- 105
- Rep Power
- 0
Does this seem right?
This was the question
e) Write a loop that prints to the screen the last letter in each string stored in a String array named stringArray starting with the first String in the array and ending with the last. (Example: if stringArray = {“Hello”, “my”, “name”, “is”, “Bob”} your loop should print
So I just want to double check, if my answer seems right.
ThanksJava Code:int j = stringArray.length; for(int i=0; i<j; i++) { String last = stringArray.[i](stringArray[i].length()-1);System.out.println(last); }Last edited by jigglywiggly; 01-22-2009 at 07:19 AM.
- 01-22-2009, 07:43 AM #2
Have you compiled it? Did you get the desired output?
CJSLLast edited by CJSLMAN; 01-22-2009 at 07:50 AM. Reason: I misunderstood the OPs post...
Chris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 01-22-2009, 08:40 AM #3
Senior Member
- Join Date
- Nov 2008
- Posts
- 105
- Rep Power
- 0
Nope, no compiler with me and I'm on the go, just tethered my phone to my lappy, too slow to download netbeans etc. I just wanted confirmation :o
- 01-23-2009, 04:50 PM #4
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks