I'm taking my first Tutorial on Java, Let's see how my learning goes 🙂↕
Java is an Object oriented programming (OOP) language, Class based, robust and secured (Java is also a platform).
How to run a Java Program -->>.
Download Java JDk (Java development Kit) .
Install and make sure Environmental Variable are been register to your PC/ Mac_Os.
Choose Your choice editor, I will recommend Vscode, Intellij Idea, Netbeans , any more choice.
Create a folder, Create a Java file and save with the extension name (.java).
Write a sample code in java.
public class Code {
public static void main (String [] args ) {
System .out .println ("Hello World!" ); //main() is the entrypoint of a java-program
}
}
Learn to run with Java Compiler as far as java jdk is installed into your system,
Open command prompt and locate your file directory then run javac sample.java.
then a "sample.class" java file will be created, This is because Java compiler runs it in bytecodes.
Next, run java sample.java.
A Java Program should always have an access modifier.
An access modifier is a special keyword that determines if other classes and method in java program can access a class or method.
Access modifiers are (public,private).
A variable is a memory location for a value, it can also be said as "A variable is a container that stores data".
"int" is a keyword used to store an integer variable.
Java Have two types which are: Primitive and Reference.
Primitive is used to store simple values.
Reference is used to store complex objects.
Category of primitive types
1) byte : Which takes 1 byte of memory and can store values from [-128, 127] in Range "The more byte available, "The larger number we can store"".
2) short : Which takes 2 bytes and can store value up to [-32k, 32k] in Range.
3) int : Which takes 4 bytes abd can store value up to [-2b, 2b] in Range.
4) long: Which takes 8 bytes.
byte, short, int and long are used to store number that don't have decimal point.
to store value with decimal point, you make use of float or double.
5) float : Which takes 4 bytes.
6) double : Which takes 8 bytes.
7) char: Which takes 2 bytes and are used to store single character ("A","B","C".) as Range.
8) boolean: Which takes 1 byte of value [True/False].
String: Which takes any amount of value
Find Scanner usage in InputUsage.java
Expressions in Java(express.java)