- Secure
- Java has advanced authentication and access-control features that help make web applications secure.
- Portable
- Java code runs on all major platforms unmodified — once a source file compiles into bytecode, that bytecode runs on any platform with a Java JDK, unlike languages that must be recompiled into machine code separately for each platform.
- Robust
- Java has strong memory management and exception-handling features that catch errors during execution and manage incorrect input.
- Object-Oriented
- A model of programming built around real-world entities — inheritance, data hiding, polymorphism. OOP's aim is to bind a portion of data and the functions that act on it together, so no other part of the code can access them directly.
- Multithreaded
- Java supports multithreaded programming, so a Java program can perform several tasks at the same time.
- Architecture-Neutral
- Compiling Java code produces bytecode that runs on many platforms with the help of the Java Runtime Environment (JRE) and Java Virtual Machine (JVM).
- Interpreted
- Java creates an intermediate representation called bytecode, which is what lets it run on any platform via the JDK.
- High-Performance
- Java uses a Just-In-Time (JIT) compiler, which converts bytecode instructions to enable faster execution.
- Distributed
- Java programs can access files on any machine on the internet using RMI and EJB, enabling distributed applications.
- Dynamic
- Java can compile and load a class dynamically, on demand — only the specifically required portion of code, rather than the whole program.
- Variables in Java
- A variable in Java is a human-readable name used to store data in computer memory — it lets a program store, read, and change data held in memory. A variable is also called an identifier, because it identifies values within a program.
- Primitive
- Uses a small, fixed amount of memory to represent a single item of data. Java has exactly eight: `byte`, `short`, `int`, `long`, `float`, `double`, `char`, and `boolean` — a Java program cannot define any others. Primitives are used so often that making them full objects would noticeably hurt performance.
- Object (Non-Primitive)
- A larger chunk of memory that can hold a great deal of data along with the methods used to process it. Every data member and local variable must be declared as either a primitive or an object (class) type.
- char
- A 16-bit character using the Unicode encoding scheme.
- abs()
- Returns the absolute value of a number — the number without its negative sign, so the result is always positive. Works on `int`, `long`, `float`, or `double` values.
- sqrt()
- Returns the square root of a positive number. Takes an `int` or `double` as input and always returns a `double`.
- pow(x, y)
- Computes x raised to the power y. Takes two `double` arguments (base, then power) and returns a `double` — integer or float arguments are implicitly converted to `double` first.
- Conditional execution
- The most common use of the "if-else" statement is to conditionally execute a block of code based on the result of a Boolean expression. For example, you might want to execute a block of code that performs a calculation only if a certain variable has a specific value.
- Decision making
- The "if-else" statement can also be used to make decisions in your code based on different conditions. For example, you might use an "if-else" statement to determine which of two different actions to take based on the value of a variable.
- Error checking
- The "if-else" statement can also be used to check for errors or invalid inputs in your code. For example, you might use an "if-else" statement to validate user input and display an error message if the input is not valid.
- Multiple branches
- The "if-else" statement can also be used to handle multiple branches of execution based on different conditions. For example, you might use multiple "if-else" statements to handle different cases in a switch statement.
- Initialization expression
- In the above example, int i = 1; is our initialization expression. In this expression we initialize the loop variable to some value so that the loop will start from the initialized value. In the above example the loop will start from 1 and continue to execute until it crosses the value 5.
- Test expression
- In the above example, i <= 5; is our test expression. The compiler will test the condition written in the test expression. If the condition evaluates to true, then the body of the loop will execute.
- Step or increment
- This part updates the expression. In the above example, i = i + 1 is our update expression. After executing the body of the loop, the update expression increments the loop variable i by 1 and then moves to test the condition written in the test expression.
- Built-in Methods
- These methods are predefined, and we can use them any time we want in our Java program. For example pow(), sqrt(), min(), etc.
- User Defined Methods
- These methods are defined or created by the programmer for performing a specific task in a program.
- inputdetails()
- for storing information in the instance variables.
- calculate()
- for calculating and storing the total and percentage obtained.
The 12 topics define many more terms than these — the full set, with flashcards, is in the notes.