Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    15
    ReputationRep:
    Just wondering why there's an error message here when programming in java

    Exception in thread "main" java.lang.NumberFormatException: For input string: "-encrypt"
    at java.lang.NumberFormatException. forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unkno wn Source)
    at java.lang.Integer.parseInt(Unkno wn Source)
    at SimpleCalc.main(SimpleCalc.java: 22)

    What to do?

    Thanks
    • Study Helper
    Offline

    16
    ReputationRep:
    Study Helper
    (Original post by PhysicsGal)
    Just wondering why there's an error message here when programming in java

    Exception in thread "main" java.lang.NumberFormatException: For input string: "-encrypt"
    at java.lang.NumberFormatException. forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unkno wn Source)
    at java.lang.Integer.parseInt(Unkno wn Source)
    at SimpleCalc.main(SimpleCalc.java: 22)

    What to do?

    Thanks
    I'm not a Java programmer, but I suspect you're going to need to post your source code so that someone can help you debug it
    Offline

    19
    ReputationRep:
    Post your code and then I can help you, it's pretty useless on its own.
    Offline

    0
    ReputationRep:
    I'm not sure but I think the problem is you were meant to have a numerical value stored as a string but instead you had "-encrypt" but I can't tell without the source. The error is triggered on line 22.
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Brussels sprouts
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.