Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: Cipher Program - Not sure what this error is - PLEASE HELP

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Cipher Program - Not sure what this error is - PLEASE HELP

    This message has been deleted.
    Last edited by Jstew2408; October 24th, 2011 at 11:07 PM.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    It would help if you posted this in your other thread which contains the code.
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    This message has been deleted.
    Last edited by Jstew2408; October 24th, 2011 at 11:05 PM.

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    private int location = alphabet.indexOf (e);
    private static String abcdefghijklmnopqrstuvwxyz;
    private static final String alphabet = abcdefghijklmnopqrstuvwxyz;
    On line 1 you call indexOf method on the alphabet variable. On line 3 you assign the alphabet variable to have the same value as the abcdefg... variable AND NOT the String "abcdefg..." not sure what you are trying to do. On line 2 the abcdefg... variable is null. Therefore alphabet is also null. So on line 1 you actually have null.indexOf which gives you the NullPointerException.
    Improving the world one idiot at a time!

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    This message has been deleted.
    Last edited by Jstew2408; October 24th, 2011 at 11:05 PM.

  6. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    We don't need you posting the full assignment. Did you read my reply? It explains what you are doing wrong. If you don't understand what I said then ask a specific question.
    Improving the world one idiot at a time!

  7. #7
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    How do I create a:
    instance variable key?
    private static final String with the alphabet?
    constructor with an int parameter?
    and a constructor with a key to be passed in value?

  8. #8
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    The only problem is that you have not initialised the alphabet variable to a String. Perhaps you meant to do this
    private static final String alphabet = "abcdefghijklmnopqrstuvwxyz";
    Notice the difference.
    Improving the world one idiot at a time!

  9. #9
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    What is the difference?

  10. #10
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    :headdesk:
    Improving the world one idiot at a time!

  11. #11
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Cipher Program - Not sure what this error is - PLEASE HELP

    Jstew2408, please do not delete your posts....this defeats the purpose of these forums as a place to get help, both for yourself and for others in the future with similar problems. I for one would like to help, but have no clue what the problem is because you deleted it. And I can only speak for myself, but deleting things like this isn't necessarily encouraging me to try to help you, now or in the future.

Similar Threads

  1. PLEASE Help With Ceasar Cipher Program!!
    By Jstew2408 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 25th, 2011, 12:23 AM
  2. Cipher Program
    By Shyamz1 in forum Object Oriented Programming
    Replies: 2
    Last Post: September 20th, 2011, 04:11 PM
  3. mod 95 vigninere cipher
    By fortune2k in forum Algorithms & Recursion
    Replies: 4
    Last Post: December 5th, 2010, 09:43 PM
  4. TCP chat attaching cipher is not running
    By Koren3 in forum Java Networking
    Replies: 4
    Last Post: May 19th, 2009, 02:52 AM
  5. [SOLVED] Interesting error cipher while sending message
    By Koren3 in forum Java Networking
    Replies: 0
    Last Post: April 29th, 2009, 09:54 AM