2.5 - Case Sensitivity
Java in case-sensitive, meaning uppercase and lowercase letters mean different things. System
is not the same as system
. As such, system.out.println()
will not compile. This applies to all the tokens. The following statements will NOT compile:
SYSTEM.out.println("hello world"); System.OUT.println("hello world"); System.out.printLine("hello world");
Note that not all programming languages are case-sensitive, but most are. Everything in Java is case-sensitive. This is actually good because it reduces naming collisions. For example, Foo
is different than foo
. There are conventions for how to name things to keep code consistent, and we will review this in a few chapters when we know a few more topics.
main
Recall that public static void main(String[] args)
is your program's entry point. Since everything is case sensitive, the following will not work as main, but it will compile:
public static void Main(String[] args) { // NOT the correct 'main' method }
Something that will not compile, even though main
is lowercase, is
Public STATIC vOID main(String[] args) { }
because keywords like public
, static
, and void
are all case-sensitive (everything is).