Results 1 to 3 of 3
- 04-17-2011, 01:56 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
trying to figure out how to minus the place of an int parameter in a method.
I'm trying to figure out how to solve this particular problem:
I'm given a limited length of a string number and im trying to figure out how to find a particular char in the string and if not, if the index of this character is greater than this character itself, reduce the index by one and return it into the method until it has found the desired number.
For example: string d = "23456";
If 3 (1) was my desired target and the index called from main was a number greater than 3 (1) and less than 6 (4) it would minus that number and return it back to the method to repeat the process until the index 1, is found.Last edited by Dev23; 04-17-2011 at 03:35 AM.
- 04-17-2011, 05:12 AM #2
Member
- Join Date
- Apr 2011
- Location
- Canada!
- Posts
- 30
- Rep Power
- 0
Here's something to get you started:
With the above piece of code you're now able to examine every character in the string. All you need to now is to find the steps to do what the assignment tells you to do.Java Code:public static void main(String[] args){ String d = "23456"; char[] allCharsInString = d.toCharArray(); for (int i = 0; i<allCharsInString.length; i++){ System.out.println(allCharsInString[i]); } }
- 04-17-2011, 10:17 AM #3
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
Similar Threads
-
Can i Pass a variable as a parameter from one method to other method
By Anagha in forum New To JavaReplies: 18Last Post: 04-18-2011, 05:39 AM -
Class<T> in method parameter
By Onra in forum New To JavaReplies: 4Last Post: 03-14-2011, 12:12 AM -
Creating array in method parameter
By Dipke in forum New To JavaReplies: 2Last Post: 02-25-2011, 09:18 AM -
Can't figure out how to use JFrame's add() method right
By Fortu in forum New To JavaReplies: 9Last Post: 01-17-2011, 12:14 AM -
Can a method take itself as parameter?
By bukake in forum New To JavaReplies: 10Last Post: 09-06-2008, 09:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks