- class Simple{
- public static void main(String args[]){
- System.out.println("Hello Java");
- }
- }
- Simple
- Object Oriented
- Portable
- Platform Independent
- Secured
- Robust
- Architectural Neutral
- Interpreted
- High Performance
- Multithreaded
- Distributed
- Dynamic
Simple:
Java is easy to learn, with a syntax that is simple, clean, and easy to understand. According to Sun Microsystems, Java is a simple programming language because:
- Java syntax is based on C++, making it easier for programmers to learn after C++
- Java has removed many complicated and rarely-used features, for example, explicit pointers, operator overloading, etc.
- No need to remove unreferenced objects because there is an Automatic Garbage Collection in Java.
Object-Oriented :
Java is an object-oriented programming language where everything is an object. Object-oriented programming means that we organize our software as a combination of various types of objects that incorporate both data and behavior.
Object-oriented programming (OOPs) is a methodology that simplifies software development and maintenance by providing some rules.
Basic concepts of OOPs are:
- Object
- Class
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
This portability makes Java ideal for cross-platform applications, allowing developers to write code once and run it anywhere with a compatible JVM. This key reason contributes to Java's widespread use in enterprise applications, web development, and mobile platforms.
There are two types of platforms software-based and hardware-based. Java provides a software-based platform.
The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on top of other hardware-based platforms. It has two components:
- Runtime Environment
- API(Application Programming Interface)
- No explicit pointer
- Java Programs run inside a virtual machine sandbox
Classloader: Classloader in Java is a component of the Java Runtime Environment (JRE) that dynamically loads Java classes into the Java Virtual Machine. It enhances security by differentiating the package for classes from the local file system and those imported from network sources.
Bytecode Verifier: It checks code fragments for illegal code that can violate access rights to objects.
Security Manager: It specifies which resources a class can access, such as reading from and writing to the local disk.
The Java language provides these securities by default. Additionally, some security features can also be explicitly implemented by an application developer through SSL, JAAS, cryptography, and so on.
Variables
Variable is a name of memory location. There are three types of variables in java: local, instance and static.
Types of Variables
There are three types of variables in Java:
- local variable
- instance variable
- static variable
1) Local Variable
A variable declared inside the body of the method is called local variable. You can use this variable only within that method and the other methods in the class aren't even aware that the variable exists.
A local variable cannot be defined with "static" keyword.
2) Instance Variable
A variable declared inside the class but outside the body of the method, is called an instance variable. It is not declared as static.
It is called an instance variable because its value is instance-specific and is not shared among instances.
3) Static variable
A variable that is declared as static is called a static variable. It cannot be local. You can create a single copy of the static variable and share it among all the instances of the class. Memory allocation for static variables happens only once when the class is loaded in the memory.
No comments:
Post a Comment