Showing posts with label learn JAVA. Show all posts
Showing posts with label learn JAVA. Show all posts

Monday, December 26, 2016

How to install java part-4

6. Execute JAVA program:

------------------------------------------------------------------------------------------------------------
To execute java program, we have to use the following command or command prompt at the location where main class .class file is existed.
Java Main_Class_Name

EX: D:\java10>java FirstApp

If we provide the above command on command prompt then operating system will identify “java” command at “C:\java\jdk1.7.0_79\bin”, through path environment variable, JVM will execute “java” command, with this, JVM Software will be activated and JVM will perform the following actions:

A. JVM will take main class name from command prompt.
B. JVM will search for main class .class file at 3 locations:
i. current location,
ii. at java predefined library and
iii. at the location referred by “class path” environment variable.
C. If the required main class .class file is not identified at all the above locations then JVM will provide the following:

JAVA6: java.lang.NoClassDefFoundError: FirstApp
JAVA7: Error: Could not find or local main class: FirstApp

Note: if the required main class .class file is available at another location then to make available that .class file to JVM, we have to set “class path” environment variable.
D:\java10>set classpath = E:\abc;

D. If the required main class .class file is available at either of the above locations them JVM will load main class byte code to the memory.
E. After loading main class byte code to the memory, JVM will search for main() method at main class.
F. If the required main () method is not available then JVM will provide the following Exceptions.

JAVA6: java.lang.NoSuchMethodError: main
JAVA7: Error: Main method not found in class FirstApp, please defined the main method as:
            public static void main(String[] args)

G. If the required main() method is existed in main class the JVM will execute main() method by creating a thread called as “main thread”.

H. When Main thread reached to the ending point of main() method, Main thread will come Dead State, with this, JVM will terminate all of its internal processes and JVM will go to shutdown mode.

Monday, December 19, 2016

JAVA Programming Format

JAVA Programming Format:

--------------------------------------------------------------------------------------------------------------------------

To design JAVA application, we have to use the following structure:

First java program
JAVA Programming Format


1. Comment Section
2. Package Section
3. Import Section
4. Classes/interface Section
5. Main class Section

The Detailed description will be in the following posts. Bookmark or Subscribe to get updated. 

Saturday, December 17, 2016

JAVA Features

JAVA Features:

To show the nature of JAVA, It provided the following features:

1. Simple
2. Object Oriented
3. Platform Independent
4. Architecture Neutral
5. Portable
6. Robust
7. Dynamic
8. Secure
9. Distributed
10. Multi Threaded
11. Interpretive
12. High Performance
-----------------------------------------------------------------------------------------------------

1. Simple:
--------------
JAVA is a Simple Language because-

i.   JAVA take less memory and less execution time.
ii.  JAVA language already removed confusing features like pointers, multi inheritance....
iii. JAVA is using simplifies syntax from C and C++.


2. Object Oriented:
--------------------------
JAVA is an object oriented programming language because JAVA allows its application to store data in the form of Objects.

3. Platform Independent:
------------------------
JAVA is platform Independent programming language because JAVA allows its application to compile in one operating system  and to execute in another operating system.

4. Architecture Neutral:
----------------------------------
JAVA is Arch Neutral language because it allows its application to compile on one hardware Arch and to execute on another Hardware Arch.

5. Portable:
-----------
JAVA is more portable programming language because it able to run its application in all the operating system & in all the
Hardware Arch.

6. Robust:
-----------------
JAVA is Robust programming language because-

i. JAVA is having very good memory management system in the form of Heap memory management system. It allocates and deallocates memory for the objects at the run time.
ii. JAVA is having very good exception handling mechanism, because JAVA has provided very good predefined library to represent & handle almost all the exception which are generating frequently in JAVA application.

7. Security:
------------------
JAVA is very good secure programming language  because-

i. JAVA has provided an implicit component inside JVM as a form of security manager in order to provide implicit security.
ii. JAVA has provided a separate middle ware service in the form of  JAAS(JAVA authorization and Authentication Service) in order to implement web security.
iii. JAVA has provided predefined implementation for almost all of the well known web security algorithm in order to provide network security.

8. Dynamic:
-----------------
JAVA is dynamic programming language because JAVA allows memory allocatio for premitive data type at run-time.

9. Distributed:
---------------------
By using JAVA, we are able to prepare the following type of application-

i. Standalone Application
ii. Distributed Application

i. Standalone Application

If we design any JAVA application without using client server architecture then that JAVA application called standalone application.

ii. Distributed Application

If we design any JAVA application with using client server architecture then that JAVA application called Distributed Application.

To prepare Distributed application, JAVA has provided separate module in the form of J2EE/JAVA EE, so that, JAVA is distributed programming language.

10. Multi Threaded:
-----------------------------
Thread is a flow of execution to perform a particular task, to execute application, there are two module:

i. Single Threaded Module
ii. Multi Threaded Module

i. Single Threaded Module

It allows only one thread to execute application, it follows sequential  execution. it will increase execution time and reduce application  performance.

ii. Multi Threaded Module

JAVA allows more than one thread to execute application . it follows parallel execution. it will reduce application execution time and it improves application performance.

JAVA is following multi threaded application to execute application. JAVA is able to provide very good environment to create and execute more than  one thread at a time.

11. Interpretive:
-----------------------
JAVA is both interpretive and compilation language because-

i. to check developer mistake in JAVA program and to translate JAVA code from high legel representation to low level representation, we need compilation to execute JAVA program . we need an interpreter inside JVM.

12. High Performance:
-------------------------------
JAVA is high performance programming language due to its rich set of features like platform independent, arch neutral, portable, dynamic, robust, multi threaded.