0% found this document useful (0 votes)
7 views16 pages

Java Programming

Uploaded by

Shivaji Kokane
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
Download as ppt, pdf, or txt
0% found this document useful (0 votes)
7 views16 pages

Java Programming

Uploaded by

Shivaji Kokane
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1/ 16

Core JAVA Programming

By S.L. Kokane
UNIT 1: Overview of JAVA Programming

History of JAVA
• JAVA is a distributed technology developed by James Gosling
and his team at Sun Micro System has released lot of rules for
JAVA and those rules are implemented by JavaSoft, USA (which
is the software division of Sun Micro System) in the year 1990.
• The original name of JAVA is OAK (which is a tree name). In the
year 1995, OAK was revised and developed software called
JAVA.
• JAVA released to the market in three categories J2SE (JAVA 2
Standard Edition), J2EE (JAVA 2 Enterprise Edition) and J2ME
(JAVA 2 Micro/Mobile Edition).
2
History of JAVA
• J2SE is basically used for developing client side applications/programs.
• J2EE is used for developing server side applications/programs.
• J2ME is used for developing micro or mobile applications/programs.
• If you exchange the data between client and server programs (J2SE and
J2EE), by default JAVA is having on internal support with a protocol
called http.
• J2ME is used for developing mobile applications and lower/system level
applications.
• To develop J2ME applications we must use a protocol called WAP
(Wireless Applications Protocol).
3
History of JAVA
• DOTNET technology is not freely downloadable whereas JAVA
freely downloadable.
• DOT NET supports Microsoft developed design patterns (general
designed patterns are not supported) whereas JAVA supports all
the design patterns which are available in IT.

4
Graphical Representation of JAVA History

5
?What is meant by distributed technology
• A service is a said to be a distributed service which runs in
multiple servers and that service can be accessed by n
number of clients.
• In order to develop distributed applications we must
require architecture called trusted network architecture.
• To develop these applications we require a technology
called J2EE. Distribute applications are preferred by large
scale organizations.
6
. Difference between .NET and JAVA
Comparing Parameters NET. Java
Integrable only with Windows operating
Operating system Compatible across all operating systems
system
Java, Kotlin, Groovy, Scala, Ruby, Python,
Programming languages used ,++C#, VB.NET, C
javascript
Microsoft Visual Studio, Rider, Mono
Supported IDEs Eclipse, IntelliJ, Oracle, Oracle Jdeveloper
develop
Common Language Runtime that executes
Runtime environment Java Virtual Machine
compiled source code

Uses ASP.NET as web application framework


Web service support and scripting For Scripting – JSF, and support – Built-in
for scripting
Java offers a lot of tools that scale the
Performance NET is faster than Java.
.performance

NET has no licensing fees as it is a free. Java offers all versions and updates for free
Licensing
.developer platform .but some features need to be purchased

NET jobs positions open in the market are . Java specialists are more in demand
Popularity
7 .limited .than .NET developers
. Difference between C and JAVA
.NO C PROGRAMMING LANGUAGE JAVA PROGRAMMING LANGUAGE
.1 .C is a Middle-Level Programming Language .Java is a High-Level Programming Language
.2 .C Programming Language is a Structured Programming Language .Java is a Class based Programming Language
.3 .C is a Procedural or Procedure-Oriented Programming Language .Java is an Object-Oriented Programming Language
.4 .A C program is divided into what we call as Functions .A Java program is divided into Classes and Objects
.5 .C language follows a Top-Down approach .Java language follows a Bottom-Up approach
.6 .C does not support Inheritance and Polymorphism .Java supports Inheritance and Polymorphism
.7 .C is standardized by ANSI and ISO authorities .Java is standardized by Oracle Corporation
C Programming language does not support function overloading and operator
.8 .overloading .Java supports function overloading and operator overloading
.9 .C does not support Exception Handling or Error handling .Java supports Exception Handling or Error Handling
10 .C programming supports usage of Global variables .Java does not support usage of Global variables
The data can be accessed from one function to another easily. Hence, data is The data cannot be accessed from one object to another object so easily. Therefore,
.11 .not secure .data is highly secured
.12 .Union in C provides memory overlapping feature .Java does not support memory overlapping feature
C does not provide automatic garbage collection feature. Therefore, free()
.13 .needs to be explicitly used .Java supports automatic garbage collection
.14 .The execution speed of C programming language is higher than that of Java .The execution speed of Java programming language is lower than that of C
.15 .C is semi-platform-dependent .Java is not platform-dependent
.16 .C language is Hardware-Dependent .Java is not Hardware-Dependent
.17 .C does not support Data Encapsulation .Java supports Data Encapsulation
.18 .C is a single-paradigm programming language .Java supports Multiple programming-paradigms
8
.19 .The filename extensions supported by C is .c and .h .The filename extensions supported by Java are .jar, .class and .java
Difference between C and JAVA
sno CPP JAVA
.Java was developed by James Gosling and his team
.1 .C++ was developed by Bjarne Stroustrup

.2 .C++ is a semi object oriented programming language .JAVA is a Purely object oriented programming language
Java programs are platform independent. Java programs are written for
C++ programs are platform dependent. They need to be compiled for Java Virtual Machine (JVM) and wherever a JVM is installed, Java
.3
.a particular platform .program will run without needing recompilation

C++ does support operator overloading. Function overloading is also Java does not support operator overloading. However, function
4
.available .overloading is possible
.Java has restricted support for pointers
.5 .C++ fully supports for pointers

.6 .C++ supports structures .Java does not support structures


.7 .C++ supports unions .Java does not support unions
.8 .C++ does not have built-in support for threads .Java fully supports threads
C++ supports manual object management through new Java relies on automatic garbage collection. It does not support
.9
.and delete keywords .destructors
C++ supports goto statement (however the use of goto is discouraged Java does not support goto statement (although gotois a reserved
.10
as not considered a good practice) keyword in Java)
Java does not really support multiple inheritance. But similar results can
.11 .C++ supports multiple inheritance
.be achieved through the use of interfaces
.12 .C++ provides support both for call by value and call by reference .Java supports only call by value
.13
9 .C++ does not support comments within source code /* … **/ In Java programs, you can write comments using
Basic Architecture of JVM (Java Virtual Machine)
• JVM has various sub components internally. You can see all of them from the above
diagram.

10
Basic Architecture of JVM (Java Virtual Machine)
• 1. Class loader sub system: JVM's class loader sub system performs 3 tasks
a. It loads .class file into memory.
b. It verifies byte code instructions.
c. It allocates memory required for the program.
• 2. Run time data area: This is the memory resource used by JVM and it is divided into 5 parts:
a. Method area: Method area stores class code and method code.
b. Heap: Objects are created on heap.
c. Java stacks:
Java stacks are the places where the Java methods are executed. A Java stack contains frames. On
each frame, a separate method is executed.
d. Program counter registers:
The program counter registers store memory address of the instruction to be executed by the micro
processor.
e. Native method stacks:
The native method stacks are places where native methods (for example, C language programs) are
executed. Native method is a function, which is written in another language other than Java.
11
Basic Architecture of JVM (Java Virtual Machine)

3. Native method interface: Native method interface is a program that connects native
methods libraries (C header files) with JVM for executing native methods.
4. Native method library: Holds the native libraries information.
5. Execution engine: Execution engine contains interpreter and JIT compiler, which covert
byte code into machine code.

JIT compiler
In the Java programming language and environment, a just-in-time (JIT) compiler is a
program that turns Java byte code (a program that contains instructions that must be
.interpreted) into instructions that can be sent directly to the processor

12
Compile and Run Java Program

• In the Java programming language, all source code is first written in plain
text files and save with the .java extension. After compilation, .class files
are generated by javac compiler. A .class file does not contain code that is
native to your processor; it instead contains bytecodes (it is machine
language of the Java Virtual Machine1 (JVM)).
• The java launcher tool then runs your application with an instance of the
Java Virtual Machine (JVM).

13
Compile and Run Java Program
Steps For compile Java Program
•First Save Java program with same as class name with .java extension.
Example: Sum.java
•Compile: javac Filename.java
Example, javac Sum.java
Note: Here javac is tools or application programs or exe files which is used for Compile the
Java program.
Steps For Run Java Program: For run java program use java tool.
Run by: java Filename
Example: java sum
Note: Here java is tools or application programs or exe files which is used for run the Java
program.
14
Compile and Run Java Program

Steps For compiling and executing the java program


•The following sequence of steps represented in the diagram use compiling the java program and executing
the java programs.

15
Compile and Run Java Program
• In the above diagram javac and java are called tools or application programs or exe files
developed by sun micro system and supply as a part of jdk 1.5/1.6/1.7 in bin folder
(starting directory of java is called java home directory).

16

You might also like