Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I keep getting a symbol not found error when i already defined the symbol please help!

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I keep getting a symbol not found error when i already defined the symbol please help!

    I am currently working hard on writing this project i have for my java programming class. I have written almost all of the code but i am stuck while complieing it in its current form. I keep getting Java error: Cannot find symbol for the line of code i have underlined. well it says [U] next to the line. its not really underlined.
    In this project i'm trying to get it to tell me if each character of a string is lower case, upper case or not a letter.
    Please help me I have no idea how to correct this error. Thank you!
    import java.util.Scanner;
     
     
    public class LetterCase
    {
    	public static boolean isThisSpace(char sentence)
    	{
    		return sentence ==(' ');
     
    	}
    	public static boolean isThisUpperCase(char sentence)
    	{
    		return (sentence>= 'A' &&sentence <= 'Z');
     
    	}
    	public static boolean isThisLowerCase(char sentence)
    	{
    		return (sentence>= 'a' && sentence <= 'z');
     
    	}
     
    	public static void main(String[] args)
    	{
     
    		Scanner keyboard_input = new Scanner(System.in);
    		System.out.print("Please enter a sentence : ");
    		String sentence = keyboard_input.nextLine();
    		int length = sentence.length();
     
     
     
    		for(int i=0; i < length; i++)
    		{			
    			char sentences = sentence.charAt(i);
    			[U]if(sentence.isThisUpperCase(sentence))[/U]
    				{
    					System.out.println(sentence.charAt(i)+ ":" + "Upper Case");
    				}


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: I keep getting a symbol not found error when i already defined the symbol please help!

    sentence is declared as a String and String does not have a isThisUpperCase() method.

    "Cannot find symbol" is the Java compiler's way of reporting when it doesn't know about a variable or a method. Common causes are typos or getting a method name (or arguments) wrong.

    The String methods that you can validly use with sentence are all in the API docs. If you intend to call the isThisUpperCase() method of your LetterCase class then drop the sentence-dot business and say

    if(isThisUpperCase(sentence))
    {
        // etc

    but notice that this method wants a char argument, not a String.

Similar Threads

  1. Symbol not found error
    By ayuda96 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 25th, 2012, 04:48 PM
  2. string identifier symbol not found
    By MeteoricDragon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 26th, 2012, 04:52 PM
  3. Remaining compile errors: no suitable method found for & cannot find symbol
    By ChuckLep in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 12th, 2011, 03:33 PM
  4. Cannot find symbol ERROR
    By yacek in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 21st, 2011, 11:39 PM
  5. Cannot find symbol error
    By AnuR in forum What's Wrong With My Code?
    Replies: 9
    Last Post: February 23rd, 2011, 02:50 PM

Tags for this Thread