By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,541 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,541 IT Pros & Developers. It's quick & easy.

Gui problem

P: 23
Okay I thought I had this figured out....it gives the gui...but then on the coversion to capitol letters it gives me all kinds of exceptions

import javax.swing.JOptionPane; //GUI support


public class UpperCase
{

public static void main(String[] args)
{
String s;

s = JOptionPane.showInputDialog("Enter any characters:");

int x = Integer.parseInt (s);


System.out.println("You entered " + x + ".");
// Convert to upper case
String upper = s.toUpperCase();

}
}
Dec 10 '06 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 1,510
Okay I thought I had this figured out....it gives the gui...but then on the coversion to capitol letters it gives me all kinds of exceptions

import javax.swing.JOptionPane; //GUI support


public class UpperCase
{

public static void main(String[] args)
{
String s;

s = JOptionPane.showInputDialog("Enter any characters:");

int x = Integer.parseInt (s);


System.out.println("You entered " + x + ".");
// Convert to upper case
String upper = s.toUpperCase();

}
}
If you enter digits it should work OK although the toUpperCase() would have no effect.

If you enter letters the Integer.parseInt (s) would give a NumberFormatException.

what should your input be, digits or letters?
Dec 10 '06 #2

P: 23
If you enter digits it should work OK although the toUpperCase() would have no effect.

If you enter letters the Integer.parseInt (s) would give a NumberFormatException.

what should your input be, digits or letters?
Either, The over all outcome should be that the lowercase letter covert to upper case.
Dec 10 '06 #3

P: 23
Either, The over all outcome should be that the lowercase letter covert to upper case.
Got it figured out thanks for the help.
Dec 10 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.