SlideShare une entreprise Scribd logo
1  sur  46
1
By Shaharyar Khan
shaharyar.khan555@gmail.com
 JAVA is a object oriented programming language with a
built-in application programming interface (API) and also
have support to handle graphics user interfaces and cater
every programming challenge
 Syntax of Java is inspired by C and C++
 It’s more Platform Independent
 It has a vast library of predefined objects and operations
 Java manages the memory allocation and de-allocation for
creating new objects. The program does not have direct
access to the memory. The so-called garbage collector deletes
automatically object to which no active pointer exists
2
 Appeared in: 1995
 Designed By: James Gosling and Sun MicroSystems
 Developer: Oracle Corporation
 Stable release: Java Standard Edition 7 Update 5 (1.7.5) (June
12, 2012; some days ago)
 Major Implementations: OpenJDK , SunJDK , OracleJDK
 Influenced by: Basically C and C++
 Influenced: C# , Groovy ,J#, ada 2005 , Beanshell etc
 Operating System: Cross-platform
 License: GNU (General public license), JAVA
community process
 Extensions: .java , .class , .jar
3
 Java compiler: Transform Java programs into Java byte code
 Java byte code: Intermediate representation for Java programs
 Java interpreter: Read programs written in Java byte code and
execute them
 Java virtual machine: Runtime system that provides various
services to running programs
 Java programming environment: Set of libraries that provide
services such as GUI, data structures etc.
 Java enabled browsers: Browsers that include a JVM + ability to
load programs from remote hosts
4
 The .class files generated by compiler are not executable
binaries , So JAVA combine compilation and interpretation
 Instead , They contain “byte-codes” to be executed by JVM
 This Approach provides Platform Independence and greater
security.
5
 The Java Runtime Environment (JRE) is an
implementation of the JVM (Java Virtual Machine)
that actually executes our java programs.
 Java Runtime Environment contains JVM, class libraries,
and other supporting files. It does not contain any
development tools such as compiler, debugger, etc.
 Actually JVM runs the program, and it uses the class
libraries, and other supporting files provided in JRE. If
you want to run any java program, you need to have JRE
installed in the system
6
 Java programs' execution speed improved significantly with
the introduction of Just-In-Time complilation 1997/1998
 the addition of language features supporting better code
analysis (such as inner classes, StringBuffer class, optional
assertions, etc.), and optimizations in the JVM itself
 Some platforms offer direct hardware support for Java, there
are microcontrollers that can run Java in hardware instead of
a software Java Virtual Machine.
7
 Everyone who want to work with JAVA should need to
know about all Editions provided by JAVA
 Mainly , JAVA provide these editions
 JAVA Standard Edition a.k.a J2SE
 JAVA Enterprise Edition a.k.a J2EE
 JAVA Micro Edition a.k.a J2ME
Let’s have a look on all of these 
8
•Micro Edition
(ME)
•Standard Edition
(SE)
•Enterprise
Edition (EE)
 J2se build under the umbrella of JAVA , which provide all
core features provided by other programming languages.
• Java Basics
• Classes and Objects
• Utilities and Wrappers
• Text Processing
• Graphics Programming
• Geometry
• Graphics
• Sequence Control
• Packages
9
• Input Output
• Collections
• Interfaces and polymorphism
• Inheritence
• Exceptions
• Threads
• Reflection
• GUIs and Event Handling
• Inner and Adapter Classes
And Many more ……..
10
 Conventions:
• Classes
• Keywords
• Variables
• Methods
• Constants
11
 Terms:
• Instance Variables and Class varaibales
• Reference Variables and Objects
1. test t; //only Ref
2. new test(); //only obj available for GC
3. test t1 = new test(); //Properly reffered object
 These are some popular IDEs which are available for java
• Eclipse
• NetBeans
• BlueJ
• JCreator
• intelliJ IDEA
• Borland JBuilder
• Dr. JAVA
12
Lets Start discussion on J2se
13
 Primitives (Exactly Same as in c#)
14
Type Contains Default Size Range
boolean true or false false 1 bit NA
char Unicode character
unsigned
u0000 16 bits or
2 bytes
0 to 216
-1 or
u0000 to uFFFF
byte Signed integer 0 8 bit or
1 byte
-27
to 27
-1 or
-128 to 127
short Signed integer 0 16 bit or
2 bytes
-215
to 215
-1 or
-32768 to 32767
int Signed integer 0 32 bit or
4 bytes
-231
to 231
-1 or
-2147483648 to
2147483647
long Signed integer 0 64 bit or
8 bytes
-263
to 263
-1 or
-9223372036854775808 to
9223372036854775807
float IEEE 754 floating point
single-precision
0.0f 32 bit or
4 bytes
�1.4E-45 to
3.4028235E+38�
double IEEE 754 floating point
double-precision
0.0 64 bit or
8 bytes
�439E-324 to
1.7976931348623157E+�
308
 Access Specifiers (A minor difference from c# )
• public
• protected
• default (no specifier)
• private
15
 Situation   public   protected   default   private 
 Accessible to
class
 from same
package? 
yes yes yes no
 Accessible to
class
 from
different
package? 
yes
 no, unless it is
a subclass 
no no
16
 Example code for Access Specifiers
 public String publicObj;
 private int privateObj;
 protected String protectedObj;
 String defaultObj; //Default
Same as for methods
 public void publicMethod();
 private void privateMethod();
 protected void protectedMethod();
 void defaultMethod(); //Default
17
18
abstract continue for new switch
assert***
default goto*
package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum****
instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp**
volatile
const*
float native super while
*
not used
**
  added in 1.2
***
  added in 1.4
****
  added in 5.0
IMPORTANT:
We can’t suggest a variable
name same as any keyword of
java like int catch; (it is wrong
and it will generate an error)
19
20
}
21
22
In last slide , We have seen this line
package com.deltasoft.testpackage;
Same as declaring namespace in .net
Classes should build in packages so we can separate the code
and keep code clean
At the end JVM can generate a jar file which contain all
packages in compiled form.
23
24
 I/O Streams
Byte Streams: handle I/O of raw binary data.
Character Streams: handle I/O of character data, automatically
handling translation to and from the local character set.
Buffered Streams: optimize input and output by reducing the
number of calls to the native API.(both input, output as well
as reader, writers)
I/O from the Command Line: describes the Standard Streams
and the Console object.(ex: InputStreamReader)
Data Streams: handle binary I/O of primitive data type and
String values.
Object Streams: handle binary I/O of objects.Basically for
serialization
25
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class CopyCharacters {
public static void main(String[] args) throws IOException {
FileReader inputStream = null;
FileWriter outputStream = null;
try {
inputStream = new FileReader(“Myfile.txt");
outputStream = new FileWriter("characteroutput.txt");
int c;
while ((c = inputStream.read()) != -1)
{
outputStream.write(c);
}
} finally {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null)
{
outputStream.close();
}
}
}
}
26
These are core interfaces through which all data
structres are inherited.
27
Interfaces
Hash table
Implementa
tions
Resizable
array
Implementa
tions
Tree
Implementa
tions
Linked list
Implementa
tions
Hash table
+ Linked
list
Implementa
tions
Set HashSet   TreeSet  
LinkedHash
Set
List   ArrayList   LinkedList  
Queue          
Map HashMap   TreeMap  
LinkedHash
Map
28
 General-purpose implementations are the most commonly
used implementations, designed for everyday use.
 Special-purpose implementations are designed for use in
special situations and display nonstandard performance
characteristics, usage restrictions, or behavior.(Type Safe)
 Concurrent implementations are designed to support high
concurrency, typically at the expense of single-threaded
performance. These implementations are part of the
java.util.concurrent package.(also blocking/non blocking ,
concurrent etc)
29
 Wrapper implementations are used in combination with
other types of implementations, often the general-purpose
ones, to provide added or restricted functionality.(We can
say extended functionality of General Purpose
Implementations)
 Convenience implementations are mini-implementations,
typically made available via static factory methods, that
provide convenient, efficient alternatives to general-purpose
implementations for special collections (for example,
singleton sets).
 Abstract implementations are skeletal implementations that
facilitate the construction of custom implementations (for
persistence or high performance)
30
import java.util.*; //All collection classes are present in java.util package
public class CollectionTest {
public static void main(String [] args) {
System.out.println( "Collection Example!n" );
int size;
HashSet collection = new HashSet ();
String str1 = "Yellow", str2 = "White", str3 = "Green", str4 = "Blue";
Iterator iterator;
collection.add(str1);
collection.add(str2);
collection.add(str3);
collection.add(str4);
System.out.print("Collection data: ");
iterator = collection.iterator();
while (iterator.hasNext()){
System.out.print(iterator.next() + " ");
}
size = collection.size();
if (collection.isEmpty()){
System.out.println("Collection is empty");
} else{
System.out.println( "Collection size: " + size);
}
}
}
31
Only difference is extends keyword. We just replace “: “ with
“extends”.
Remaining things and concept are almost same rahter than one or two
things which will be discuss in next slides.
32
Here is some difference in java and .net.
In .net , we can only override those methods which are
declared with vritual keyword
But
In java , for our child classes all methods are available for
overridding (of parent) and we haven’t need to specify any
keyword to tell JVM that I will override this method.
Only those methods , which are declared final are not available for overriding to child
classes.
33
Difference occurs while implementing
 In .net
class InterfaceImplementer :IMyInterface
 In JAVA
class InterfaceImplementer implements IMyInterface
So , the difference is implements keyword.
34
 Same like .net , JAVA does’t support multiple inheritence but
supports multiple childs to be inherit.
class TradingSystem{
public String getDescription(){
return "electronic trading system";
}
}
class DirectMarketAccessSystem extends TradingSystem{
public String getDescription(){
return "direct market access system";
}
}
class CommodityTradingSystem extends TradingSystem{
public String getDescription(){
return "Futures trading system";
} //This is basically a polymorphism
}
35
 Exceptions concept and syntax are exactly same in JAVA
and .net
try
{
//code block
}
catch(Exception ex)
{
//code block
}
In java ,Exception is basically derived from class Throwable .Lets see the
hierarchy of Exceptions.
36
JAVA supports Reported and unreported exception
handling
37
ClassNotFoundException,
AclNotFoundException,
ActivationException,
AlreadyBoundException,
ApplicationException,
AWTException,
BackingStoreException,
BadAttributeValueExpException,
BadBinaryOpValueExpException,
BadLocationException,
BadStringOperationException,
BrokenBarrierException,
CertificateException,
DatatypeConfigurationException,
DestroyFailedException,
ExecutionException,
ExpandVetoException,
FontFormatException,
GeneralSecurityException,
NullPointerException,
IllegalAccessException,
ArrayIndexOutOfBoundException,
IllegalArgumentException,
TypeMisMatchException,
InvalidApplicationException,
InvalidMidiDataException,
38
 Thread is a very vast topic even thousands of books have written on
this topic
 Here We are not going to discuss about what is Thread but only we
will see what are the major differences in implementation and
syntax of Threads between .net and JAVA
 In .net We create Threads in this way
class Launcher{
void Coundown() {
lock(this) {
for(int i=4;i>=0;i--) {
Console.WriteLine("{0}
seconds to start",i);
}
Console.WriteLine("GO!!!!!");
}
}
}
39
Class Demo{
static void Main( string[] args){
Launcher la = new Launcher();
Thread firstThread = new Thread(new ThreadStart(la.Coundown));
Thread secondThread =new Thread(new ThreadStart(la.Coundown));
Thread thirdThread = new Thread(new ThreadStart(la.Coundown));
firstThread.Start();
secondThread.Start();
thirdThread.Start();
}
}
40
 In JAVA , We have two ways to create a Thread
By implementing Runnable interface
OR
By extending Thread class
When We implement a interface , Then We have to create a Thread
object in that class
When we extend our class from a Thread , Then we have to create
object of our own class.
Let’s take a look in examples
41
42
class NewThread extends Thread {
NewThread() {
// Create a new, second thread
super("Demo Thread");
System.out.println("Child thread: " + this);
start(); // Start the thread
} // This is the entry point for the second thread.
public void run() {
try {
for(int i = 5; i > 0; i--) {
System.out.println("Child Thread: " + i);
// Let the thread sleep for awhile.
Thread.sleep(500);
}
} catch (InterruptedException e) {
System.out.println("Child interrupted.");
} System.out.println("Exiting child thread.");
}
}
43
class ExtendThread {
public static void main(String args[]) {
new NewThread();
// create a new thread
try {
for(int i = 5; i > 0; i--) {
System.out.println("Main Thread: " + i);
Thread.sleep(1000);
}
} catch (InterruptedException e) {
System.out.println("Main thread interrupted.");
}
System.out.println("Main thread exiting.");
}
}
44
 Reflection and Serialization is also a very important
features provided by JAVA
 There purpose and implementations are same as in c#
 Serialization provide us Data persistence through out
the network
 Reflection is use for reverse engineering
45
 We have looked into some core things that are
compulsory to start work with JAVA programming.
 Now , after interpreting these things anyone can easily
explore JAVA features
46

Contenu connexe

Tendances

Great cup of java
Great  cup of javaGreat  cup of java
Great cup of javaCIB Egypt
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machineLaxman Puri
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateAnton Keks
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classesyoavwix
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz SAurabh PRajapati
 
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIsCS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIsKwangshin Oh
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Sandeep Rawat
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSteve Fort
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: IntroductionAnton Keks
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 

Tendances (20)

Great cup of java
Great  cup of javaGreat  cup of java
Great cup of java
 
Unit 2 Java
Unit 2 JavaUnit 2 Java
Unit 2 Java
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, Hibernate
 
What is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK TechnologiesWhat is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK Technologies
 
Java essential notes
Java essential notesJava essential notes
Java essential notes
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
 
Java features
Java featuresJava features
Java features
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
JAVA BYTE CODE
JAVA BYTE CODEJAVA BYTE CODE
JAVA BYTE CODE
 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz
 
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIsCS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
CS6270 Virtual Machines - Java Virtual Machine Architecture and APIs
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Introducing Java 7
Introducing Java 7Introducing Java 7
Introducing Java 7
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
 
What is-java
What is-javaWhat is-java
What is-java
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 

Similaire à What is Java Technology (An introduction with comparision of .net coding)

Similaire à What is Java Technology (An introduction with comparision of .net coding) (20)

Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Java basic
Java basicJava basic
Java basic
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
basic_java.ppt
basic_java.pptbasic_java.ppt
basic_java.ppt
 
java slides
java slidesjava slides
java slides
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Introduction to java programming tutorial
Introduction to java programming   tutorialIntroduction to java programming   tutorial
Introduction to java programming tutorial
 
Java chapter 1
Java   chapter 1Java   chapter 1
Java chapter 1
 
Java lab zero lecture
Java  lab  zero lectureJava  lab  zero lecture
Java lab zero lecture
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Basic Java I
Basic Java IBasic Java I
Basic Java I
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
Java introduction
Java introductionJava introduction
Java introduction
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 

Dernier

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Dernier (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

What is Java Technology (An introduction with comparision of .net coding)

  • 2.  JAVA is a object oriented programming language with a built-in application programming interface (API) and also have support to handle graphics user interfaces and cater every programming challenge  Syntax of Java is inspired by C and C++  It’s more Platform Independent  It has a vast library of predefined objects and operations  Java manages the memory allocation and de-allocation for creating new objects. The program does not have direct access to the memory. The so-called garbage collector deletes automatically object to which no active pointer exists 2
  • 3.  Appeared in: 1995  Designed By: James Gosling and Sun MicroSystems  Developer: Oracle Corporation  Stable release: Java Standard Edition 7 Update 5 (1.7.5) (June 12, 2012; some days ago)  Major Implementations: OpenJDK , SunJDK , OracleJDK  Influenced by: Basically C and C++  Influenced: C# , Groovy ,J#, ada 2005 , Beanshell etc  Operating System: Cross-platform  License: GNU (General public license), JAVA community process  Extensions: .java , .class , .jar 3
  • 4.  Java compiler: Transform Java programs into Java byte code  Java byte code: Intermediate representation for Java programs  Java interpreter: Read programs written in Java byte code and execute them  Java virtual machine: Runtime system that provides various services to running programs  Java programming environment: Set of libraries that provide services such as GUI, data structures etc.  Java enabled browsers: Browsers that include a JVM + ability to load programs from remote hosts 4
  • 5.  The .class files generated by compiler are not executable binaries , So JAVA combine compilation and interpretation  Instead , They contain “byte-codes” to be executed by JVM  This Approach provides Platform Independence and greater security. 5
  • 6.  The Java Runtime Environment (JRE) is an implementation of the JVM (Java Virtual Machine) that actually executes our java programs.  Java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc.  Actually JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE. If you want to run any java program, you need to have JRE installed in the system 6
  • 7.  Java programs' execution speed improved significantly with the introduction of Just-In-Time complilation 1997/1998  the addition of language features supporting better code analysis (such as inner classes, StringBuffer class, optional assertions, etc.), and optimizations in the JVM itself  Some platforms offer direct hardware support for Java, there are microcontrollers that can run Java in hardware instead of a software Java Virtual Machine. 7
  • 8.  Everyone who want to work with JAVA should need to know about all Editions provided by JAVA  Mainly , JAVA provide these editions  JAVA Standard Edition a.k.a J2SE  JAVA Enterprise Edition a.k.a J2EE  JAVA Micro Edition a.k.a J2ME Let’s have a look on all of these  8 •Micro Edition (ME) •Standard Edition (SE) •Enterprise Edition (EE)
  • 9.  J2se build under the umbrella of JAVA , which provide all core features provided by other programming languages. • Java Basics • Classes and Objects • Utilities and Wrappers • Text Processing • Graphics Programming • Geometry • Graphics • Sequence Control • Packages 9
  • 10. • Input Output • Collections • Interfaces and polymorphism • Inheritence • Exceptions • Threads • Reflection • GUIs and Event Handling • Inner and Adapter Classes And Many more …….. 10
  • 11.  Conventions: • Classes • Keywords • Variables • Methods • Constants 11  Terms: • Instance Variables and Class varaibales • Reference Variables and Objects 1. test t; //only Ref 2. new test(); //only obj available for GC 3. test t1 = new test(); //Properly reffered object
  • 12.  These are some popular IDEs which are available for java • Eclipse • NetBeans • BlueJ • JCreator • intelliJ IDEA • Borland JBuilder • Dr. JAVA 12
  • 13. Lets Start discussion on J2se 13
  • 14.  Primitives (Exactly Same as in c#) 14 Type Contains Default Size Range boolean true or false false 1 bit NA char Unicode character unsigned u0000 16 bits or 2 bytes 0 to 216 -1 or u0000 to uFFFF byte Signed integer 0 8 bit or 1 byte -27 to 27 -1 or -128 to 127 short Signed integer 0 16 bit or 2 bytes -215 to 215 -1 or -32768 to 32767 int Signed integer 0 32 bit or 4 bytes -231 to 231 -1 or -2147483648 to 2147483647 long Signed integer 0 64 bit or 8 bytes -263 to 263 -1 or -9223372036854775808 to 9223372036854775807 float IEEE 754 floating point single-precision 0.0f 32 bit or 4 bytes �1.4E-45 to 3.4028235E+38� double IEEE 754 floating point double-precision 0.0 64 bit or 8 bytes �439E-324 to 1.7976931348623157E+� 308
  • 15.  Access Specifiers (A minor difference from c# ) • public • protected • default (no specifier) • private 15  Situation   public   protected   default   private   Accessible to class  from same package?  yes yes yes no  Accessible to class  from different package?  yes  no, unless it is a subclass  no no
  • 16. 16
  • 17.  Example code for Access Specifiers  public String publicObj;  private int privateObj;  protected String protectedObj;  String defaultObj; //Default Same as for methods  public void publicMethod();  private void privateMethod();  protected void protectedMethod();  void defaultMethod(); //Default 17
  • 18. 18 abstract continue for new switch assert*** default goto* package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum**** instanceof return transient catch extends int short try char final interface static void class finally long strictfp** volatile const* float native super while * not used **   added in 1.2 ***   added in 1.4 ****   added in 5.0 IMPORTANT: We can’t suggest a variable name same as any keyword of java like int catch; (it is wrong and it will generate an error)
  • 19. 19
  • 20. 20 }
  • 21. 21
  • 22. 22 In last slide , We have seen this line package com.deltasoft.testpackage; Same as declaring namespace in .net Classes should build in packages so we can separate the code and keep code clean At the end JVM can generate a jar file which contain all packages in compiled form.
  • 23. 23
  • 24. 24  I/O Streams Byte Streams: handle I/O of raw binary data. Character Streams: handle I/O of character data, automatically handling translation to and from the local character set. Buffered Streams: optimize input and output by reducing the number of calls to the native API.(both input, output as well as reader, writers) I/O from the Command Line: describes the Standard Streams and the Console object.(ex: InputStreamReader) Data Streams: handle binary I/O of primitive data type and String values. Object Streams: handle binary I/O of objects.Basically for serialization
  • 25. 25 import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class CopyCharacters { public static void main(String[] args) throws IOException { FileReader inputStream = null; FileWriter outputStream = null; try { inputStream = new FileReader(“Myfile.txt"); outputStream = new FileWriter("characteroutput.txt"); int c; while ((c = inputStream.read()) != -1) { outputStream.write(c); } } finally { if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } } } }
  • 26. 26 These are core interfaces through which all data structres are inherited.
  • 27. 27 Interfaces Hash table Implementa tions Resizable array Implementa tions Tree Implementa tions Linked list Implementa tions Hash table + Linked list Implementa tions Set HashSet   TreeSet   LinkedHash Set List   ArrayList   LinkedList   Queue           Map HashMap   TreeMap   LinkedHash Map
  • 28. 28  General-purpose implementations are the most commonly used implementations, designed for everyday use.  Special-purpose implementations are designed for use in special situations and display nonstandard performance characteristics, usage restrictions, or behavior.(Type Safe)  Concurrent implementations are designed to support high concurrency, typically at the expense of single-threaded performance. These implementations are part of the java.util.concurrent package.(also blocking/non blocking , concurrent etc)
  • 29. 29  Wrapper implementations are used in combination with other types of implementations, often the general-purpose ones, to provide added or restricted functionality.(We can say extended functionality of General Purpose Implementations)  Convenience implementations are mini-implementations, typically made available via static factory methods, that provide convenient, efficient alternatives to general-purpose implementations for special collections (for example, singleton sets).  Abstract implementations are skeletal implementations that facilitate the construction of custom implementations (for persistence or high performance)
  • 30. 30 import java.util.*; //All collection classes are present in java.util package public class CollectionTest { public static void main(String [] args) { System.out.println( "Collection Example!n" ); int size; HashSet collection = new HashSet (); String str1 = "Yellow", str2 = "White", str3 = "Green", str4 = "Blue"; Iterator iterator; collection.add(str1); collection.add(str2); collection.add(str3); collection.add(str4); System.out.print("Collection data: "); iterator = collection.iterator(); while (iterator.hasNext()){ System.out.print(iterator.next() + " "); } size = collection.size(); if (collection.isEmpty()){ System.out.println("Collection is empty"); } else{ System.out.println( "Collection size: " + size); } } }
  • 31. 31 Only difference is extends keyword. We just replace “: “ with “extends”. Remaining things and concept are almost same rahter than one or two things which will be discuss in next slides.
  • 32. 32 Here is some difference in java and .net. In .net , we can only override those methods which are declared with vritual keyword But In java , for our child classes all methods are available for overridding (of parent) and we haven’t need to specify any keyword to tell JVM that I will override this method. Only those methods , which are declared final are not available for overriding to child classes.
  • 33. 33 Difference occurs while implementing  In .net class InterfaceImplementer :IMyInterface  In JAVA class InterfaceImplementer implements IMyInterface So , the difference is implements keyword.
  • 34. 34  Same like .net , JAVA does’t support multiple inheritence but supports multiple childs to be inherit. class TradingSystem{ public String getDescription(){ return "electronic trading system"; } } class DirectMarketAccessSystem extends TradingSystem{ public String getDescription(){ return "direct market access system"; } } class CommodityTradingSystem extends TradingSystem{ public String getDescription(){ return "Futures trading system"; } //This is basically a polymorphism }
  • 35. 35  Exceptions concept and syntax are exactly same in JAVA and .net try { //code block } catch(Exception ex) { //code block } In java ,Exception is basically derived from class Throwable .Lets see the hierarchy of Exceptions.
  • 36. 36 JAVA supports Reported and unreported exception handling
  • 38. 38  Thread is a very vast topic even thousands of books have written on this topic  Here We are not going to discuss about what is Thread but only we will see what are the major differences in implementation and syntax of Threads between .net and JAVA  In .net We create Threads in this way class Launcher{ void Coundown() { lock(this) { for(int i=4;i>=0;i--) { Console.WriteLine("{0} seconds to start",i); } Console.WriteLine("GO!!!!!"); } } }
  • 39. 39 Class Demo{ static void Main( string[] args){ Launcher la = new Launcher(); Thread firstThread = new Thread(new ThreadStart(la.Coundown)); Thread secondThread =new Thread(new ThreadStart(la.Coundown)); Thread thirdThread = new Thread(new ThreadStart(la.Coundown)); firstThread.Start(); secondThread.Start(); thirdThread.Start(); } }
  • 40. 40  In JAVA , We have two ways to create a Thread By implementing Runnable interface OR By extending Thread class When We implement a interface , Then We have to create a Thread object in that class When we extend our class from a Thread , Then we have to create object of our own class. Let’s take a look in examples
  • 41. 41
  • 42. 42 class NewThread extends Thread { NewThread() { // Create a new, second thread super("Demo Thread"); System.out.println("Child thread: " + this); start(); // Start the thread } // This is the entry point for the second thread. public void run() { try { for(int i = 5; i > 0; i--) { System.out.println("Child Thread: " + i); // Let the thread sleep for awhile. Thread.sleep(500); } } catch (InterruptedException e) { System.out.println("Child interrupted."); } System.out.println("Exiting child thread."); } }
  • 43. 43 class ExtendThread { public static void main(String args[]) { new NewThread(); // create a new thread try { for(int i = 5; i > 0; i--) { System.out.println("Main Thread: " + i); Thread.sleep(1000); } } catch (InterruptedException e) { System.out.println("Main thread interrupted."); } System.out.println("Main thread exiting."); } }
  • 44. 44  Reflection and Serialization is also a very important features provided by JAVA  There purpose and implementations are same as in c#  Serialization provide us Data persistence through out the network  Reflection is use for reverse engineering
  • 45. 45  We have looked into some core things that are compulsory to start work with JAVA programming.  Now , after interpreting these things anyone can easily explore JAVA features
  • 46. 46