The online doc A good textbook: Introduction to Java Programming and Data Structures, Author Y. Daniel Liang
- object oriented programming lannguage
- create by James Gosling in 1995
- similar to c++ but easier
- 3 billion devices run Java programs
- very popular
- Mobile apps for Android (Kotlin is more common or Swift)
- Desktop App using Java Swing, JavaFX
- Enterprise Applications
- Games (such as Minecraft)
- Cloud based applications
- Web applications
- Build enterprise application
- learn more
- Difference between Compiler and Interpreter in Java
- A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that computer's processor uses.
- The interpreter read each stateemnt of code and then converts or executes it directly
- The process of verifying and enforcing the constraints of types - type checking - may occur either at compile time (static check) or at a run-time (dynamic check)
- Static type checking is when types are checked during compilation, before the program is run. This means that any type errors will be caught early on and can be fixed before the program is deployed. Dynamic type checking, on the other hand, happens at runtime. This means that type errors can go undetected until the program is actually being used.
- Go to the offical website of Jetbrains
- If you are a student, you can get InteliJ IDEA free.
- To download Intellij IDEA, go to developer tools > Pluging and services > Toolbox App
- Then open toolbox and download IntelliJ IDEA
- read more on bytecode here
The example codes for the following subjects can be found here
-
Comments
- two ways to add comments
- use "//" (single ligne comments) or "/" and "/" (Multi Line comments)
- Comments has no effect when you run a code
-
Variables - A varibles allows us to store a value into a placeholer which we can use it later
-
Primitives Data Types Differences
- Primitives types are used to store simple values. For instance, whole numbers, decimal values and characters:
- boolean
- byte
- short
- char
- int
- long
- float (store decimal value, but bigger number and take more space in memory)
- double
- Primitives types are used to store simple values. For instance, whole numbers, decimal values and characters:
-
Numeric Literals with underscore
- Reprensent big numbers with underscore for readability
- Arithmetic operarors
- Increment and Decrement Operators
- Comparison Operators
- Short and re-assignment
- Naming Variables
- CamelCase
- Strings
- Reference types and objects
- Reference types and objects differences
-
Pass by Value differences
-
Arrays
-
O and null Values for arrays
code snipet can be found here
loops - constraint that allows us to repeat a block of codes
- For loops
- Loops and arrays
- Enhanced For loop
- For i vs Enhanced For loop
- While loop
- Do while
code snipet can be found here
if statement allows us to execute a block of codes based on a condition
-
if statement
-
if statement with conditions
-
Else if
-
AND logical operator
-
OR logical operator
-
- a review of the chapter logic in discrete math or discrete structure or math for computer science can help
- a recommended course for discrete math
-
Switch
Use switch to replace nested if conditions
read more on packages here
- How to find the location of your package
- Creating packages
- Paclages lives under src
- Have a root package
- Import Keywords
- import with fully qualified nanme is java
All you need to know can be found here
When building method:
- Access modifiers
- Optional static
- Return type
- Name
- Optional parameters
- Method Body
- Optional return value
Exammple: public static void main(String[] args) { body }
- Naming convention for methods
- Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized
- e.g: run(); runFast(); getBackground();
-
Understand public static void main
-
- It allows to define a variable using var and without specifying the type of it
public class Main { // private var brand = "jpstayfocus" (var cant work) public static void main(String[] args) { // Type inference with var keyword (works for every datatype, // but can be used only for local variables) /* String name = "Jamila"; String[] names = {"Jamila", "Joseph"}; int age = 22; boolean isAdult = false; double balance = 1_000_000.33; */ var name = "Jamila"; var names = new String[]{"Jamila", "Joseph"}; var age = 22; var isAdult = false; var balance = 1_000_000.33; } }
-
Break keyword and loops
-
Continue keyword
-
Final keyword
- allows to create constants, prevent inheritance, and method overriding
-
Implicit and Explicit type casting
- Working with strings
- How strings are stored in memory
- Strings are immutable
- String lateral vs String Onject
- Comparing String with ==
- Comparing String with .equals
- Useful String Static Methods
Code on Dates can be found here
- Local Date Time
- Local Date and Local Time
- Creating specific Dates
- Zoneelds
- Other Dates Classes
- Problem with double (precision)
- Big decimal
- Big decimal methods
-
Exception in java explained here
- Creating Files
- Writing to Files
- Reading from files
- Try with Ressources