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.

  • Re: Common Java Mistakes

    Problem description: Case Sensitivity, spelling
    Problem category: Compile-time Problems

    Diagnosis Difficulty: Easy
    Difficulty to Fix: Easy


    Java is case sensitive, as well as spelling sensitive. So, the following would all be viewed as different variables in Java:

    double value;
    double Value;
    double valeu;

    Error Message

    Usually Java will complain about a missing declaration. However, you will have to check the spelling/case of both the definition and the usage as either of these could be the problem.

    public class Test
    {
        public static void main(String[] args)
        {
            double Value;
            value = 3;
        }
    }

    Test.java:6: cannot find symbol
    symbol : variable value
    location: class Test
    value = 3;
    Suggested fixes

    Determine which item is misspelled (or in the wrong case), and fix it.

    public class Test
    {
        public static void main(String[] args)
        {
            double value;
            value = 3;
        }
    }
    This article was originally published in forum thread: Common Java Mistakes started by helloworld922 View original post