We will start with what is programming language.
Language: In generally we will communicate with others using language. Language has some set of keywords and rules to communicate.
Similar way programming language communicate in between application and compiler.
Java is Object Oriented programming language. Here OOP is one of the programming methodology and it has some rules and design principles(Inheritance, Abstraction, Encapsulation and Polymorphism etc).
Java follows and implemented the rules and principles of OOP. Hence we are calling Java is Object Oriented Language.
Advantages Of Java:
1. Java is open source
2. Java is scalable. We can extend the java applications easily based on requirements.
3. Security --- because java run inside jvm(not run directly on OS runtime environment)
4. Java is platform independent : Java byte code will run on different platforms with no changes.
5. Object Oriented --- We can simplify s/w development and maintenance with OOPs using objects, classes. inheritance, polymorphism etc...
6. Multi Threaded -- Thread is separate program which we can execute concurrently. Main advantage of multi threading is memory. It is doe not occupy memory per each thread just it shares common memory area.
7. Robust -- Strong. Java uses strong memory management and it uses automatic Garbage collection.
8. Portable -- we can take java byte code to any platform.
Why Java is platform dependent: When we compile java program, it will execute on JVM and it will first generate the .class file in byte code format. And this byte code will run on different platforms with no change. i.e it is platform independent. We can run this .class file in any platform which has JRE installed on it.
JVM consists class loader to load class into memory and byte code verified to verify byte code and execution engine to execute the java application.
More details of Java class loader is available @ JAVA Class Loader
Sample Java class:
package com.sample.java.testing;
public class HelloWorldJavaTest {
public static void main(String[] args) {
System.out.println("welcome to java");
}
}
Save: save the file with .java extension as HelloWorldJavaTes.java.
Compile: We can compile the class using java compiler with command
javac -HelloWorldJavaTest.java
If no compilation errors available, then it will create HelloWorldJavaTest.class file in the same folder where HelloWorldJavaTest.java file is there.
Run: We can run the java class using JRE with command java HelloWorldJavaTest.
Execution :
It will check for main method and it will execute lines of code sequentially written inside main method. Here we have written just one print statement.
Output: We will get out put as "welcome to java" if we run this program.
Language: In generally we will communicate with others using language. Language has some set of keywords and rules to communicate.
Similar way programming language communicate in between application and compiler.
Java is Object Oriented programming language. Here OOP is one of the programming methodology and it has some rules and design principles(Inheritance, Abstraction, Encapsulation and Polymorphism etc).
Java follows and implemented the rules and principles of OOP. Hence we are calling Java is Object Oriented Language.
Advantages Of Java:
1. Java is open source
2. Java is scalable. We can extend the java applications easily based on requirements.
3. Security --- because java run inside jvm(not run directly on OS runtime environment)
4. Java is platform independent : Java byte code will run on different platforms with no changes.
5. Object Oriented --- We can simplify s/w development and maintenance with OOPs using objects, classes. inheritance, polymorphism etc...
6. Multi Threaded -- Thread is separate program which we can execute concurrently. Main advantage of multi threading is memory. It is doe not occupy memory per each thread just it shares common memory area.
7. Robust -- Strong. Java uses strong memory management and it uses automatic Garbage collection.
8. Portable -- we can take java byte code to any platform.
Why Java is platform dependent: When we compile java program, it will execute on JVM and it will first generate the .class file in byte code format. And this byte code will run on different platforms with no change. i.e it is platform independent. We can run this .class file in any platform which has JRE installed on it.
JVM consists class loader to load class into memory and byte code verified to verify byte code and execution engine to execute the java application.
More details of Java class loader is available @ JAVA Class Loader
Sample Java class:
package com.sample.java.testing;
public class HelloWorldJavaTest {
public static void main(String[] args) {
System.out.println("welcome to java");
}
}
Save: save the file with .java extension as HelloWorldJavaTes.java.
Compile: We can compile the class using java compiler with command
javac -HelloWorldJavaTest.java
If no compilation errors available, then it will create HelloWorldJavaTest.class file in the same folder where HelloWorldJavaTest.java file is there.
Run: We can run the java class using JRE with command java HelloWorldJavaTest.
Execution :
It will check for main method and it will execute lines of code sequentially written inside main method. Here we have written just one print statement.
Output: We will get out put as "welcome to java" if we run this program.
No comments:
Post a Comment