Results 1 to 7 of 7
  1. #1
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Can you overwrite a String?

    I am making a password system, and I want to overwrite a string.

    First I enter the pin and is saved into a String, and when I save a new password, I want it to overwrite the same String.

    For example if I saved '123' into savedpassword=""; , and if i enter a new password, will it overwrite it?

    Is this possible?



    Sorry, if i am asking a dumb question.
    Thanks.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Can you overwrite a String?

    For example if I saved '123' into savedpassword=""; , and if i enter a new password, will it overwrite it?
    Did you try it? What happened? Often it is useful to write up a small test program to demonstrate to yourself, one way or another, a particular functionality such as this.
    Last edited by doWhile; 05-07-2012 at 08:22 PM.

  3. #3
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Re: Can you overwrite a String?

    Quote Originally Posted by doWhile View Post
    Did you try it? What happened? Often it is useful to write up a small test program to demonstrate to yourself a functionality
    Okay, I will let you know. :)

  4. #4
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Re: Can you overwrite a String?

    Quote Originally Posted by doWhile View Post
    Did you try it? What happened? Often it is useful to write up a small test program to demonstrate to yourself, one way or another, a particular functionality such as this.
    Oh yea! I got it to overwrite.

    BUT now its getting password validated, and then i can enter a new password that saves it.

    Also, im creating this through java GUI code, and was wondering, how can I disable keypad input?


    Thanks.

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Can you overwrite a String?

    Glad you got it...for what its worth overwrite is incorrect terminology - the first variable is a reference to a String object, and you reassign that reference to another String object.

    For your other question, I suggest posting a new question and include an SSCCE/code that demonstrates what you have...as we have no clue how you are receiving 'keypad input'.

  6. #6
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Re: Can you overwrite a String?

    Quote Originally Posted by doWhile View Post
    Glad you got it...for what its worth overwrite is incorrect terminology - the first variable is a reference to a String object, and you reassign that reference to another String object.

    For your other question, I suggest posting a new question and include an SSCCE/code that demonstrates what you have...as we have no clue how you are receiving 'keypad input'.
    but the thing is, I can't show a lot of it because I could get plagiarised if someone copies mine.

  7. #7
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Can you overwrite a String?

    Quote Originally Posted by juxta View Post
    but the thing is, I can't show a lot of it because I could get plagiarised if someone copies mine.
    Well then, best of luck. But let me say this: that's one advantage of an SSCCE - its not a code dump, which will often do little to help you get an answer any faster, but a quick and boiled down example of the question you are asking. Google the acronym to learn what it truly is

Similar Threads

  1. pdfbox to overwrite image on a pdf
    By vammpiro in forum Advanced Java
    Replies: 1
    Last Post: 03-09-2012, 03:54 PM
  2. to overwrite with showSavedDialog!!!
    By DarkGhetto22 in forum New To Java
    Replies: 2
    Last Post: 06-27-2011, 06:25 AM
  3. Replies: 3
    Last Post: 02-16-2009, 09:20 PM
  4. file overwrite method
    By nanaji in forum Advanced Java
    Replies: 5
    Last Post: 11-14-2008, 09:19 AM
  5. Create and overwrite files
    By wmrwl in forum New To Java
    Replies: 7
    Last Post: 10-01-2008, 04:16 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
  •