Link: https://hyperskill.org/curriculum
Key Feture:
Platform independence "Write once, Run anywhere"
Used:
Android, Finacial Service Industry, Telecomunication, Embedded Systems, Medical Applications.
Java has:
Garbage Collector-> Automatic cleans the memory from unused ubjects during runtime.
Primary
an imperativ language based on OOP concepts: almost every part of the program is an object. U can say it's a full interaction between objects.
Support Modern Programming Paradigms:
- Generic Programming
- Concurrent Programming
- Functional Programming
Values of different datatypes are called literals
.
Integer Literals
0, 1, 3, 10, 1000, 1500
For more readability we an use ' _ ' symbol. Example:
1000235745 -> 1_000_235_745
Character Literals
A single character represent a letter , a number, a symbol using a Single Quote
'A', 'C', '7', '!', '$', " ", '_'.
Don't confuse 7 with '7' those are not the same.
A Character can't include 2 or more digits, letters, symbols because it represent only one Character.
Incorrect Character Liteals:
'123', 'abc'
String Literls
Sequence of Characters. They represent text information.
To Write a String we use Double Quotes " "
"Text I want to learn Java."
!!Remeber!!
Do not confuse literals.
123 is Integer || "123" is String
'A' is Char || "A" is String
'1' is Char || 1 is Integer
Hello World
class Main{
public static void main(String [] args){
System.out.println("Hello, Tony!");
}
}
Basic Terminology:
Program:
a sequence of instructions called "Statements" executed one by one, in order from top to bot.
Statement:
a single action terminated by a ;
Block:
a group of 0 or more statements enclosed by {...}.
Method:
a sequence of staments that represent a high-level operation(known as subprogram or procedure).
Syntax:
a set of rules that define how the program should be writed.
Keywords:
a word that have a specific meaning in the programming language(public, class). Can't be used as names for variables or functions.
Identifier:
a word that refer to something in the program(such as variable name or function name).
Comment:
a textual explanation of what code does. Comments are ignored at runtine. Comments start with // single-line
WhiteSpace:
all characters that are not visible(space, tab, newline).
class Main{
public static void main(String [] args){
System.out.println("Hello, Tony!");
}
}
1. public class
It's the basic unit of program. Every Java program must have at least one class.
A class can have any name 'App'
, 'Main'
, 'Program'
but it must not start with a digit.
A set of Braches {...}
enclose the body of a class.