Basics of Java
Basics of Java
BATCH 5
What is Java?
Java is a programming language and a platform. Java is a high level, robust, object-oriented and
secure programming language.
Application
1.Desktop Applications such as acrobat reader, media
player, antivirus, etc.
2.Web Applications such as irctc.co.in, javatpoint.com, etc.
3.Enterprise Applications such as banking applications.
4.Mobile
5.Embedded System
6.Smart Card
7.Robotics
8.Games, etc.
Features of Java
1. Simple
2. Object-Oriented
3. Portable
4. Platform independent
5. Secured
6. Robust
7. Architecture neutral
8. Interpreted
9. High Performance
10. Multithreaded
11. Distributed
12. Dynamic
Creating Hello World Example
class Simple
{
public static void main(String args[])
{
System.out.println("Hello Java");
}
}
javac
To compile:
Simple.java
When we compile Java program using javac tool, the Java compiler converts the source code
into byte code.
Parameters used in First Java Program
A variable is the name of a reserved area allocated in memory. In other words, it is a name of the
memory location. It is a combination of "vary + able" which means its value can be changed.
•local variable
•instance variable
•static variable
1.public class A
2.{
3. static int m=100;//static variable
4. void method()
5. {
6. int n=90;//local variable
7. }
8. public static void main(String args[])
9. {
10. int data=50;//instance variable
11. }
12.}//end of class
Data Types in Java
Data types specify the different sizes and values that can be stored in the variable. There are two types
of data types in Java:
1.Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and
double.
2.Non-primitive data types: The non-primitive data types include Classes, Interfaces, and Arrays.