• Home
  • Public Speaking
  • Travel
Ready to code? Not too fast.
Let's first remember Java Basics.

Terms

Compiling : is the act of turning source code into object code.
Linking : is the act of combining object code with libraries into a raw executable.
Building : is the sequence composed of compiling and linking, with possibly other tasks such as installer creation.
A .java file : contains your Java source code
A .class file : contains the Java bytecode produced by the Java compiler. It runs on the JVM to execute a Java application.
A Jar file : is an archive of otherfile, most likely class files.
JDK : Java Development Kit is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc) and other tools needed in Java development.
JRE : stands for “Java Runtime Environment” and may also be written as “Java RTE.” The Java Runtime Environment provides the minimum requirements for executing a Java application; it consists of the Java Virtual Machine (JVM), core classes, and supporting files.
JVM : whenever you write java command on the command prompt to run the java class, an instance of JVM is created.

Primitive Datatypes

* Initialize like: new Integer(2) (do not confuse with new Integer[2])
* Wrapper class is a class whose object wraps or contains a primitive data types. (ex: Integer)
* Casting : Assigning a value with a type to another type. A smaller type is automatically casted to a larger value.

Operators

Before going over all operations, first of all, we have to understand how negative numbers are stored to be ready for bitwise operations:
It is done by taking the complement and adding 1. Or over decimal values: substract the value from 256.
OK, now check all operators:

Sometimes, it is difficult to decide the order of operations, right?

Now, lets remember what associativity is:
In the following case, since associativity is from left-right; 1+2 is evaluated differently:

Pre/Post Increment/Decrement is worth being practiced:

Access Modifiers


4 Main OOP Concepts

1. Encapsulation

You set variables as private and let them be read or updated by others via only getter and setter methods. In this way, others do not know how you manage them.

2. Polymorphism

a. Overloading

Methods with same name but diffetent input parameters. Both methods are in the same class.

b. Overriding

Methods with same name and input parameters. One of the methods is inherited from super class.

3. Inheritance

a. Extension


Super class can be initiated in subclass type:

b. Interface


4. Abstraction

It is a hybrid approach: Some attributes/methods are reusable (common), but some others are different in various instances. Both circle & rectangle have "color"s, but different "area"s.

A few more remarks

Static Keyword

Static methods are usable only over instances.

Break

"Break" stops the loop of a "For", "while" or "switch".