Definition/Overview: Java is a high-level, secure, and multi-threaded object-oriented programming (OOP) language. It has many use cases and remains popular across many platforms/devices due to its strong compatibility/portability, as well as its memory efficiency/performance advantages in comparison to many other compiled languages. Its design is credited to James Gosling of Sun Microsystems, which has since been purchased by the Oracle Corporation.
Java is also renowned for its APIs (Application Programming Interfaces), which have both minor and major differences across Java versions. Each API contains pre-built packages and classes that can be imported into programs to provide commonly used features/functionalities.
JVM | JRE | JDK | |
---|---|---|---|
Term | Java Virtual Machine | Java Runtime Environment | Java Development Kit |
Use Case | Byte code to machine code conversions | Executing Java apps | Developing (writing and compiling) Java code |
Key Component(s) | Java byte code | JVM and libraries for Java apps | JRE and compiler (and other developer tools) |
Dependency Status | Platform-Independent | Platform-Dependent | Platform-Dependent |
-
The
static
keyword creates class members that belong to a class.- Thus, these class members are shared among every instance of that class.
- Non-static class members would belong to an object (an instance of the class).
-
The
final
keyword declares constant methods and variables.- As they are constants, they cannot be overriden.
- Unextendable classes can also be created.
-
The
this
keyword is used to refer to a present instance of a class.- This provides differentiation between local and instance variables.
-
The
try
keyword creates a block of code that might throw an exception.- The
catch
keyword creates a block that can handle that exception. - The (optional)
finally
keyword creates a code block to be executed even if an exception is not thrown.
- The
-
String
class instances are immutable (not modifiable).StringBuffer
class instances are mutable.
-
The
.equals()
method is used for comparing the content of objects.- The
==
operator is used to compare objects' references.
- The