how to validate string value in java

Simple prompt with condition

Page 1 of 1

4 Replies - 4290 Views - Last Post: 27 September 2010 - 01:37 AM Rate Topic: -----

#1 wicked  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-September 10

how to validate string value in java

Posted 23 September 2010 - 10:58 PM

Hi can someone know how to validate string value in prompt user here's my problem:

1. prompt user ("Do you want to play?:Please enter y or n")
2. condition : if user input y prompt user "lets play"
3. condition : if user input n prompt user "goodbye"
4. if user don't enter y or n continue prompt

plz help i'm new in java....
Is This A Good Question/Topic? 0
  • +

Replies To: how to validate string value in java

#2 javadork  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 135
  • Joined: 21-August 10

Re: how to validate string value in java

Posted 23 September 2010 - 11:17 PM

Show us what you have tried so far, then we can help you with any problems you might have.
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10194
  • View blog
  • Posts: 37,646
  • Joined: 27-December 08

Re: how to validate string value in java

Posted 24 September 2010 - 04:48 PM

Hint- think about a while loop. We're happy to help you with code you wrote. :)
Was This Post Helpful? 0
  • +
  • -

#4 b0ng01  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 38
  • View blog
  • Posts: 169
  • Joined: 16-July 10

Re: how to validate string value in java

Posted 24 September 2010 - 06:49 PM

In the order you asked.

1. http://www.java-tips....scanner-3.html
2. http://download.orac...ndbolts/if.html
3. http://download.orac...olts/while.html
Was This Post Helpful? 0
  • +
  • -

#5 wicked  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-September 10

Re: how to validate string value in java

Posted 27 September 2010 - 01:37 AM

tnx..it might help...i'll post my code..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1