Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

Fusion Blog
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new

Search Courses

Objective:

In this article we will discuss the detailed introduction of java along with the link to Install Eclipse. This article will also help you to understand how to create a new project in Java.

Introduction to Java:
Java was developed by James Gosling in Sun Microsystems.
It is a platform independent programming language.
This language was initially named as OAK and later renamed as JAVA.

 

 What is java?

Java is an object oriented language that is:
• Concurrent
• Class based
• Object oriented
• Specifically designed to have as few implementation dependencies as possible.

 

Where java is used?

Java is used in various enterprise level application/frameworks all around the world.
Java has been used to develop below frameworks: –
• Hadoop
• Spring
• Hibernate
• Struts


Versions of JAVA:

a1

Features of JAVA:

 

• Simple: Java is easy to learn and its syntax is quite simple, clean and easy to understand.The confusing and difficult concepts of C++ are either left out in Java or they have been re-implemented in a cleaner way.
• Object oriented: Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than “logic”.
• Multithreading: Java multithreading feature makes it possible to write program that can do many tasks simultaneously. Benefit of multithreading is that it utilizes same memory and other resources to execute multiple threads at the same time, like While typing, grammatical errors are checked along.
• Platform Independent: Unlike other programming languages such as C, C++ etc which are compiled into platform specific machines. Java is guaranteed to be written once, run-anywhere language.
• Secure: When it comes to security, Java is always the first choice. With java secure features it enable us to develop virus free, temper free system. Java program always runs in Java runtime environment with almost null interaction with system OS, hence it is more secure.
• Robust: Java makes an effort to eliminate error prone codes by emphasizing mainly on compile time error checking and runtime checking. But the main areas which Java improved were Memory Management and mishandled Exceptions by introducing automatic Garbage Collector and Exception Handling.
• Portable: Java Byte code can be carried to any platform. No implementation dependent features. Everything related to storage is predefined, example: size of primitive data types.
• High Performance: Java is an interpreted language, so it will never be as fast as a compiled language like C or C++. But, Java enables high performance with the use of just-in-time compiler.

 

What is byte code in JAVA?
Byte code is an intermediate code which gets generated when a Java file is compiled using a Javac compiler. After compilation .class file is generated this contains the byte code. This code is platform independent.

 

Byte code and Java virtual machine(JVM):
Java byte code is the form of instructions that the Java Virtual Machine executes.
A Java programmer need not understand byte code at all.
Java Virtual Machine (JVM):
• Runs the byte code
• Makes Java platform independent
• Handles memory management

 

JAVA Memory Management:

C/C++ has pointers. User can allocate memory to these pointers.
If the pointer is accessed without allocating memory or invalid pointer is accessed then program crashes.
These issues are removed from Java as Java does not have pointers. Complete memory management is handled by Java itself.

a2

 

Heap and Garbage Collector:

There are two types of Allocation: Heap allocation and Stack allocation.
The memory area in JVM where objects are created is called Heap.
Heap is divided into two parts. Young space and old space.

a3

-The memory is freed during runtime by a special thread called Garbage Collector.

-Garbage collector is also known as daemon thread.
-Daemon thread is the thread which will be executed behind the scene.
-If the garbage collector finds that the particular object is unused for long time, then it de-allocates that object from the memory.
-All the newly allocated objects are created in young space. Once the young space is full then garbage collector is called so that memory can be released.
-If the object has lived for long in young space then they will be moved to old space. Once the old space is full, garbage collector is called to release the space in heap.

a4

 

How Java works internally?

a5
-The Byte code generated by the Java compiler is sent to the Class Loader.
-Class Loader is responsible for loading the class and for byte code verification.
-Java virtual machine consists of:
• Java interpreter: It is used for interpretation i.e. for execution.
• Just-in time (JIT) compiler: JIT is use to increase the speed.
• Runtime system
• Operating system
• Hardware.
• JVM comes under Java Runtime Environment.


Data types in Java:

a6

JAVA supports 8 data types.

Integer and float: for numeric purpose.
Name Width Range
long 64 –9,223,372,036,854,775,808 to
9 ,223,372,036,854,775,807
int 32 –2,147,483,648 to 2,147,483,647
short 16 – 32,768 to 32,767
byte 8 – 128 to 127

Character: for character purpose.

Boolean: for result purpose i.e. for evaluation. For e.g. a>b, True or false.


 Data operations:

Types of Data operations:

1. Arithmetic operation
2. Unary operators
3. Relational Operators
4. Logical Operators

a7

 

Required software for Java Programming:

• JDK 1.7 64 bit or 32 bit according to your machine.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads- 1880260.html

a8


• Eclipse J2EE version for 64 bit or 32 bit according to your machine.
https://www.eclipse.org/downloads/

 

Select a workplace:

Once the eclipse is downloaded, select a workplace.
For e.g. c:\users\Administrator\workplace

 


How to Create a project:

 

1. Open the eclipse
2. Click on File (File option is on top left hand side of your eclipse)
3. Click on New
4. Now click on Java project

5. Then a new window “New java project” will open.
6. Write the name of your project. For e.g. Day1, then click on Finish

7. Now click on Day 1. Under Day 1 there will be an option src, right click on that.

8. Once you right click on src, click on New and then click on “package”, a new window “New Java package” will open.

9. Write the Name as com.test and then click on Finish

10. Now right click on com.test, then click on New and then click on Class.

11. A new window New Java class will open.

12. Now write the name of the class. For e.g. MyFirstProgram.
13. Select the Modifier as Public and also select the option public static void main(String[ ]args) under “Which method stubs would you like to create?”
14. Now click on Finish.

 Now you can see this window on your eclipse:

a17

Once the class is created, we are ready to write the First Program in the above window.

 

 


Varun Kapila

Add comment


Security code
Refresh

About the Author

Varun Kapila

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Apr 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
  1  2  3  4  5  6  7
  8  91011121314
15161718192021
22232425262728
2930     

Enquire For Training

Related Items

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner