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...

public static char upperCaseToLowerCase(char ch)
   {

      System.out.println("Enter an Uppercase letter");
    	char upper =MyInput.readChar();
 		System.out.println("the lower case is" + upper);

	}

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

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
}

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

public class switchCase
{
public static char upperCaseToLowerCase(char ch)
{
	char lowerch;
	lowerch = // lowercase version of ch
	return lowerch;
}
 
public static void main(String[] args)
{
	System.out.println("Enter an Uppercase letter");
	char upper =MyInput.readChar();
	System.out.println("Upper case = " + upper);
	System.out.println("Lower case = " + upperCaseToLowerCase(upper));
}
}

Thank you for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.