Java distinguishes upper from lower case in variable names - Java Language Basics

Java examples for Language Basics:Variable

Introduction

That is, Java is case-sensitive.

Demo Code

public class Main {
  public static void main(String arguments[]) {
    int MyVar;/* w  w w .  ja  v a  2 s  .c  om*/
    // myvar variable is different from MyVar
    int myvar = 0;


    // Generate a syntax error at compile time:
    // cannot find symbol variable myVar
    // System.out.println(myVar);
    
    System.out.println(myvar);
  }
}

Result


Related Tutorials