Main Notes
- Class-based, Object-Oriented
- Commonly used for Client-Server Web Applications.
- Portability
- Designed to have as few implementation dependencies as possible.
- “Write once, run anywhere”: Compiled code can be run be run on all platforms without recompilation.
- Compiled to Java bytecode that can be run on any Java virtual machine.
- Principles
- It must be simple, object-oriented, and familiar.
- It must be robust and secure.
- It must be architecture-neutral and portable.
- It must execute with high performance.
- It must be interpreted, threaded, and dynamic.
- Designed in terms of nouns(classes) interacting with eachother with verbs(methods) as operations on and between them.
- Automatic Garbage Collector: Collects memory when objects no longer referenced for security and safety.
- All code is within classes.
Criticism
- Overhead of interpreting bytecode generally slower than native executables.
- Possibly slower and requiring more memory than programs written in C++.
Variables
- Every variable is an object excluding primitive data types.
- Primitive data types: integers, floating-point numbers, booleans, characters.
Functions
- Does not support operator overloading.
- java launcher calls the
main
method to pass control to the program.
Syntax
Similar syntax to C and C++.
Libraries/Dependancies
- Standard libraries provide access to host-specific features such as graphics, threading and networking.
- Comments: single line:
\\
preceding the comment,/* */
for multi-line comments.