Java introduction
What is Java?
A popular programming language that was created in 1995 by James Gosling
Oracle owned the Java and more than 3 billion devices run Java
Use of Java
Mobile applications (specially Android apps)
Desktop applications
Web applications
Web servers and application servers
Games
Database connection etc.
Why Use Java?
The most popular programming language in the world
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
Large demand in the current job market
Easy to learn, simple to use
It is open-source and free
It is secure, fast and powerful
It has a huge community support
Java is an object oriented language which gives a clear structure to programs and allows code to be reused, lowering development costs
As Java is close to C++ and C#, it makes it easy for programmers to switch to Java or vice versa
Object-oriented language such as C++ or java uses a bottom-up approach where each object is identified first.
Most of the procedural or low level languages follow Top-down approach like C language. Similarly high level languages like java ,c++ etc follows Bottom-Up Approach.
Procedural Programming
Procedural Programming is the use of code in a step-wise procedure to develop applications.
Procedural Programming divides the program into small programs and refers to them as functions. Object Oriented Programming divides the program into small parts and refers to them as objects
Java setup
Install eclipse and that is containing jdk
or
Download JDK and One code editor for better experience
Check installed JDK version
Open command prompt and run " java --version "
After install JDK we can simply use any text editor like notepad, notepad++, or any code editor or IDEs .
Java First Code
Simple write code in notepad, save with the top class name with .java extension like Hello.java but need to define file class in code as the code file name
Java file name: Hello.java
Java file top class: class Hello{ ..code }
Example: HelloWorld
Run Java code with Command Prompt
Open java file directory in command prompt
run javac Hello.java"
run java Hello
Run Java with CMD
Note: If your are using simple code editor like notepad follow the instruction to run java
Step 1: open java file directory in command prompt and follow the command
Step 2: Run the command " javac Hello.java "
Step 3: Then run " java Hello "
By javac command The java file will firstly converted into byte codes then into machine level language.
Java with VS-Code
Download JDK and install in machine
Download VS Code and install
Download java extension in VS-Code
Download code runner