JAVA INTRODUCTION
WHAT IS JAVA |
Java is a popular programming language, created in 1995.
It is owned by Oracle, and more than 3 billion devices run Java.
It is used for:
- Mobile applications (specially Android apps)
- Desktop applications
- Web applications
- Web servers and application servers
- Games
- Database connection
- And much, much more!
WHY USE JAVA |
- Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
- It is one of the most popular programming language in the world
- It is easy to learn and simple to use
- It is open-source and free
- It is secure, fast and powerful
- It has a huge community support (tens of millions of developers)
- 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
Java is a general purpose class based object oriented programming language designed for having lesser implementation dependencies it is a computing platform for application development
Java is fast, secured and reliable therefore it is widely used for developing java application is laptops data certain cellphones etc.….
ADVANTAGES OF JAVA |
• Object oriented
• Secured
• Robust
• Platform independent
• Multi-threaded
DIS ADVANTAGES OF JAVA |
• Performance slow
• Memory consumption
• Cost
• Less machine interactive
• Garbage collection
• No breakup facility
• Not attractive look
SYNTAX |
In Java, every application begins with a class name, and that class must match the filename.
Let's create our first Java file, called Main.java, which can be done in any text editor (like Notepad).
The file should contain a "Hello World" message, which is written with the following code:
Public class HelloJava {
Public Static void main(String[] args) {
System.out.printIn(“Hello World”);
}
}
we created a Java file called Main.java, and we used the following code to print "Hello World".
HERE
Hellojava is a class name
Main is main method
String is pre defined class name
Args is String variable
System is pre defined class
Out is a variable name
Print is method
THE MAIN METHOD
The main() method is required and you will see it in every Java program:
Public static void main(String[]args) {
Any code inside the main() method will be executed. You don't have to understand the keywords before and after main. You will get to know them bit by bit while reading this tutorial.
For now, just remember that every Java program has a class name which must match the filename, and that every program must contain the main() method.
SYSTEM.OUT.PRINTIN()
Inside the main() method, we can use the println() method to print a line of text to the screen:
Public static void main(String[]args) {
System.out.printIn(“Hello Would");