Introduction to Java Programming , Java is a programming language. Java is used to develop mobile apps, web apps, desktop apps, games and much more.
What you”ll learn:
- Java Programming
Description
Java is a popular programming language, created in 1995.
It is owned by Oracle, and more than 3 billion devices run Java.
Data types are divided into two groups:
- Primitive data types – includes byte, short, int, long, float, double, boolean and char
- Non-primitive data types – such as String, Arrays and Classes
Type casting is when you assign a value of one primitive data type to another type.
In Java, there are two types of casting:
- Widening Casting (automatically) – converting a smaller type to a larger type size
byte -> short -> char -> int -> long -> float -> double - Narrowing Casting (manually) – converting a larger type to a smaller size type
double -> float -> long -> int -> char -> short -> byte
Operators are used to perform operations on variables and values.
Java has the following conditional statements:
- Use if to specify a block of code to be executed, if a specified condition is true
- Use else to specify a block of code to be executed, if the same condition is false
- Use else if to specify a new condition to test, if the first condition is false
- Use switch to specify many alternative blocks of code to be executed
Loops can execute a block of code as long as a specified condition is reached.
Loops are handy because they save time, reduce errors, and they make code more readable.