Changing uppercase letter to lower case

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2004
Posts: 3
Reputation: femmegirl is an unknown quantity at this point 
Solved Threads: 0
femmegirl femmegirl is offline Offline
Newbie Poster

Changing uppercase letter to lower case

 
0
  #1
Nov 1st, 2004
I need to write a JAVA program that converts an uppercase letter to a lowercase letter ... the method declaration should be
public static char upperCasetoLowerCase(char ch) ... I think I am missing something in my thought process. Can anyone help? Here is what I have tried...

  1.  
  2. public static char upperCaseToLowerCase(char ch)
  3. {
  4.  
  5. System.out.println("Enter an Uppercase letter");
  6. char upper =MyInput.readChar();
  7. System.out.println("the lower case is" + upper);
  8.  
  9. }

When I try and execute this I get a message that says Exception in thread "main" java.lang.nosuchmethoderror:main I really have no clue what this means
Last edited by alc6379; Nov 2nd, 2004 at 4:02 pm. Reason: added [code] tags
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 84
Reputation: jerbo is an unknown quantity at this point 
Solved Threads: 1
jerbo jerbo is offline Offline
Junior Poster in Training

Re: Changing uppercase letter to lower case

 
0
  #2
Nov 1st, 2004
Well, every Java Application that is executed (from a command console, or DOS prompt,) should have a 'main' method

public void main ( String[] args) {
// Your main method
}
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,056
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 129
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Changing uppercase letter to lower case

 
0
  #3
Nov 1st, 2004
Basically, every java program must be written within a class. The method above does not seem to be within a class (by the same filename.java) In addition, a program must always start from within public static void main(String[] args) { ... } From inside the main method, you can call other methods, such as upperCaseToLowerCase(char). However, there must always be a main method to start out from.

Put the following, with slight modifications, into a file called switchCase.java

  1. public class switchCase
  2. {
  3. public static char upperCaseToLowerCase(char ch)
  4. {
  5. char lowerch;
  6. lowerch = // lowercase version of ch
  7. return lowerch;
  8. }
  9.  
  10. public static void main(String[] args)
  11. {
  12. System.out.println("Enter an Uppercase letter");
  13. char upper =MyInput.readChar();
  14. System.out.println("Upper case = " + upper);
  15. System.out.println("Lower case = " + upperCaseToLowerCase(upper));
  16. }
  17. }
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 3
Reputation: femmegirl is an unknown quantity at this point 
Solved Threads: 0
femmegirl femmegirl is offline Offline
Newbie Poster

Re: Changing uppercase letter to lower case

 
0
  #4
Nov 2nd, 2004
Thank you for the help
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC