JAVA INTRODUCTION
WHAT IS JAVA |
Java is a popular programming language, created in 1995, designed by JAMES GOSLING and it's owned by ORACLE.
It is owned by Oracle, and more than 3 billion devices run Java.
It is used for:
- Mobile applications (especially 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 languages 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
DEFINATION OF JAVA |
ADVANTAGES OF JAVA |
• Object oriented
• Secured
• Robust
• Platform independent
• Multi-threaded
DISADVANTAGES OF JAVA |
• Performance slow
• Memory consumption
• Cost
• Less machine interactive
• Garbage collection
• No breakup facility
• Not attractive look
FEATURES OF JAVA |
The primary objective of java programming language created was to make it portable, simple, and secure programming language.
The features of java are also known as JAVA BUZZWORDS
A list of most important features of java language
simple
Object-Oriented
Portable
Platform-independent
Secured
Robust
Architecture neutral
interpreted
High Performance
multi threated
Distributed
Dynamic
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:
package mypackage; Public class HelloJava { Public Static void main (String args[]) { System.Out.printIn(“Hello World”); } } |
OUTPUT: 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");