• Post Reply Bookmark Topic Watch Topic
  • New Topic

My Big Problem  RSS feed

 
Hobi Kod
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

i have an exam and i try to study for it
But i didnt my question. Please help me.

i try to getting sentence from users with JOptionpane. And i want to send array because i have to search small characters in my sentences. So i need find array joptionpane.showinputdialog

this is my code and does not work. Please help me

 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Just saying it doesn't work isn't very helpful. In what way doesn't it work?

To be honest I'm not 100% sure what you are trying to achieve but if it's to split the string into an array of characters then your code should work, although it will throw an exception if you press Cancel in the JOptionPane. You might want to consider storing the returned value in a String variable and then test for null before attempting to split it.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again
Why are so many people taught to use option pane for keyboard input? It is a very old‑fashioned type of coding. Most people use a Scanner object nowadays.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!