Member-only story
Is Java Case Sensitive? (Java Interview Question and Answer)
Java developers — especially beginners — often come across this common interview question:
“Is Java case sensitive?”
Let’s explore the answer in detail with examples to help you understand it clearly.
✅ Quick Answer
Yes, Java is a case-sensitive programming language.
This means uppercase and lowercase letters are treated as different. So, for example, MyClass
and myclass
are not the same in Java.
📌 What Does Case Sensitivity Mean?
Case sensitivity refers to the ability of a programming language to differentiate between uppercase and lowercase letters in identifiers like:
- Class names
- Variable names
- Method names
- Keywords
🔍 Java Case Sensitivity in Action
Let’s take a look at some simple examples to see how Java treats uppercase and lowercase characters.
💡 1. Class Names
public class MyClass {
public static void main(String[] args) {
System.out.println("Hello Java");
}
}
✅ The class is correctly named MyClass
.
But what if you save the file as myclass.java
?