Results 1 to 4 of 4
  1. #1
    Da1dmoney is offline Member
    Join Date
    Dec 2010
    Posts
    3
    Rep Power
    0

    Default Help with returning

    Java 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;
    }
    }
    My program code is finished I am just trying to get the results that are printed put in
    Java Code:
    System.out.print(mChar);
    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.
    Any help would be appreciated thanks in advance

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    Da1dmoney is offline Member
    Join Date
    Dec 2010
    Posts
    3
    Rep Power
    0

    Default

    yes i am sure. I can both compile and run it.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. Returning Value from a method
    By Mirix in forum New To Java
    Replies: 12
    Last Post: 06-01-2010, 09:48 PM
  2. Returning An Array
    By elektronika in forum New To Java
    Replies: 2
    Last Post: 12-07-2009, 03:43 PM
  3. read() is not returning -1
    By Mewes in forum Networking
    Replies: 0
    Last Post: 11-30-2009, 10:46 PM
  4. Keeps returning null
    By ribbs2521 in forum New To Java
    Replies: 7
    Last Post: 02-23-2009, 02:25 AM
  5. Why is my list returning nothing?
    By xcallmejudasx in forum New To Java
    Replies: 2
    Last Post: 11-05-2008, 03:51 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
  •