Results 1 to 4 of 4
Thread: Help with returning
- 12-14-2010, 08:59 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 3
- Rep Power
- 0
Help with returning
My program code is finished I am just trying to get the results that are printed put inJava Code:public class Mapper implements ScramblerIF { private static String map = "drsjckpwrypwsftylmzxopqtdo"; String str = "null"; char[] chars = str.toCharArray(); int length = str.length(); { for(int i=0; i<length; i++) { char aChar = str.charAt(i); char upper = Character.toUpperCase(aChar); int num = (upper - 'A'); char mChar = map.charAt(num); String chars = Character.toString(mChar); System.out.print(mChar); } } public String scramble(String str) { /* char[] chars = str.toCharArray(); int length = str.length(); { for(int i=0; i<length; i++) { char aChar = str.charAt(i); char upper = Character.toUpperCase(aChar); int num = (upper - 'A'); char mChar = map.charAt(num); String mapped = Character.toString(mChar); System.out.print(mChar); }*/ return str; } }to be able to be put in the return statement so i can return it. Alot is omitted out int the String Scrambler method because it the same coding as the top. I was messing around with both to try to get it in the return statement.Java Code:System.out.print(mChar);
Any help would be appreciated thanks in advance
- 12-14-2010, 09:44 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Are you sure that you can compile this code?
- 12-14-2010, 11:20 AM #3
Member
- Join Date
- Dec 2010
- Posts
- 3
- Rep Power
- 0
yes i am sure. I can both compile and run it.
- 12-15-2010, 02:38 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
So what's wrong with your return statement in scramble() method?
Similar Threads
-
Returning Value from a method
By Mirix in forum New To JavaReplies: 12Last Post: 06-01-2010, 09:48 PM -
Returning An Array
By elektronika in forum New To JavaReplies: 2Last Post: 12-07-2009, 03:43 PM -
read() is not returning -1
By Mewes in forum NetworkingReplies: 0Last Post: 11-30-2009, 10:46 PM -
Keeps returning null
By ribbs2521 in forum New To JavaReplies: 7Last Post: 02-23-2009, 02:25 AM -
Why is my list returning nothing?
By xcallmejudasx in forum New To JavaReplies: 2Last Post: 11-05-2008, 03:51 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks