SlideShare uma empresa Scribd logo
1 de 23
Instructor: @Subash @Paudyal
Pokhara & Tribhuvan University
Kathmandu, Nepal
Training on Java
Programming
• Java Introduction
• Java History
• Why Learn Java
• Java Version
• Java IDE
• Java Features
• Java Program Structure
• What happens at Compile and Runtime ?
• Distinction between JVM, JRE and JDK
Session 1: Fundamentals
© paudyalsubash@yahoo.com 2
• Java is a programming language and a platform.
• Java is a high level, robust, secured and object-oriented
programming language.
Introduction (What java)
© paudyalsubash@yahoo.com 3
• James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language
project in June 1991.
• Firstly, it was called "Greentalk" by James Gosling and file extension was .gt.
• After that, it was called Oak and was developed as a part of the Green project.
• Why Oak? Oak is a symbol of strength and chosen as a national tree of many
countries like U.S.A., France, Germany, Romania etc. (presumably because he liked
the look of an oak tree that was right outside his window at Sun).
• In 1995, Oak was renamed as "Java" because it was already a trademark by Oak
Technologies.
• Why java? The team gathered to choose a new name. According to James Gosling
"Java was one of the top choices along with Silk". Since java was so unique, most
of the team members preferred java.
• Java is an island of Indonesia where first coffee was produced (called java coffee).
• Originally developed by James Gosling at Sun Microsystems (which is now a
subsidiary of Oracle Corporation) and released in 1995.
History (How Java)
© paudyalsubash@yahoo.com 4
Why Java?
• Large codebase of already written applications
• 9 million of professional Java developers
• Lots of enterprise applications were developed and are being
developed in Java
• The same program can run on different platforms
• Mobile Android development is done in Java
• According to Sun, 3 billion devices run java. There are many
devices where java is currently used.
© paudyalsubash@yahoo.com 5
• Some of the devices using java are as follows:
• Desktop Applications such as acrobat reader, media player, antivirus etc.
• Web Applications such as irctc.co.in, javatpoint.com etc.
• Enterprise Applications such as banking applications.
• Mobile
• Embedded System
• Smart Card
• Robotics
• Games etc.
Devices using Java
© paudyalsubash@yahoo.com 6
• There are mainly 4 type of applications that can be created using java
programming:
• Standalone Application: (J2SE) – Standard Edition
It is also known as desktop application or window-based application. An application that we
need to install on every machine such as media player, antivirus etc. AWT and Swing are used
in java for creating standalone applications.
• Web Application:
An application that runs on the server side and creates dynamic page, is called web
application. Currently, servlet, jsp, struts, jsf etc. technologies are used for creating web
applications in java.
• Enterprise Application: (J2EE) – Enterprise Edition
An application that is distributed in nature, such as banking applications etc. It has the
advantage of high level security, load balancing and clustering. In java, EJB is used for creating
enterprise applications.
• Mobile Application: (J2ME) – Micro Edition
An application that is created for mobile devices. Currently Android and Java ME are used for
creating mobile applications.
Types of Java Applications
© paudyalsubash@yahoo.com 7
• Simple
• Object oriented
• Platform independent
• Secured
• Multi-threaded
• Robust
• Portable
• High Performance
Features of Java
© paudyalsubash@yahoo.com 8
• syntax is based on C++ (so easier for programmers to learn it
after C++).
• removed many confusing and/or rarely-used features e.g.,
explicit pointers, operator overloading etc.
• No need to remove unreferenced objects because there is
Automatic Garbage Collection in java.
Simple
© paudyalsubash@yahoo.com 9
• Object-oriented means we organize our software as a combination of
different types of objects that incorporates both data and behaviour.
• Object-oriented programming(OOPs) is a methodology that simplify
software development and maintenance by providing some rules.
• Basic concepts of OOPs are:
• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
Object Oriented
© paudyalsubash@yahoo.com 10
• A platform is the hardware or software environment in which a program
runs.
• There are two types of platforms software-based and hardware-based.
• Java provides software-based platform. The Java platform differs from most
other platforms in the sense that it's a software-based platform that runs
on top of other hardware-based platforms.
• It has two components:
• Runtime Environment
• API(Application Programming Interface)
• java is platform independent Java code can be run on multiple platforms
e.g.Windows,Linux,Sun Solaris,Mac/OS etc.
• Java code is compiled by the compiler and converted into bytecode.This
bytecode is a platform independent code because it can be run on multiple
platforms i.e. Write Once and Run Anywhere(WORA).
Platform Independent
© paudyalsubash@yahoo.com 11
© paudyalsubash@yahoo.com 12
• Java is secured because:
• No explicit pointer
• Programs run inside virtual machine sandbox.
• Security provided by Java Language
• Classloader
• adds security by separating the package for the classes of
the local file system from those that are imported from
network sources.
• Bytecode Verifier
• checks the code fragments for illegal code that can violate
access right to objects.
• Security Manager
• determines what resources a class can access such as
reading and writing to the local disk.
Secure
© paudyalsubash@yahoo.com 13
• A thread is like a separate program, executing concurrently. We can
write Java programs that deal with many tasks at once by defining
multiple threads. The main advantage of multi-threading is that it
shares the same memory. Threads are important for multi-media,
Web applications etc.
• Robust simply means strong. Java uses strong memory management.
There are lack of pointers that avoids security problem. There is
automatic garbage collection in java. There is exception handling and
type checking mechanism in java. All these points makes java robust.
• We may carry the java bytecode to any platform.
• Java is faster than traditional interpretation since byte code is "close"
to native code still somewhat slower than a compiled language (e.g.,
C++)
Multi-Tasking, Robust, Portable, high
performance
© paudyalsubash@yahoo.com 14
Run First Program
• Three steps to run the Java
program
 Write the program and save it in a file
with the name that ends with .java,
for example
HelloWorld.java
 Compile the program using javac
compiler which creates
HelloWorld.class file, for example
javac HelloWorld.java
 Run your program:
java HelloWorld
class HelloWorld {
public static void main(String[] args)
{
System.out.println (“Hello,
world!");
}
}
© paudyalsubash@yahoo.com 15
• class keyword is used to declare a class in java.
• public keyword is an access modifier which represents visibility, it means it is visible to all.
• (if its not public JVM classes might not able to access it)
• static is a keyword, if we declare any method as static, it is known as static method. The
core advantage of static method is that there is no need to create object to invoke the
static method. The main method is executed by the JVM, so it doesn't require to create
object to invoke the main method. So it saves memory.
• (While JVM tries to execute Java program it doesn't know how to create instance of main
class as there is no standard constructor is defined for main class)
• void is the return type of the method, it means it doesn't return any value.
• (because it doesn't return any thing to caller which is JVM)
• main represents startup of the program.
• String[] args is used for command line argument. We will learn it later.
• System.out.println() is used print statement. We will learn about the internal working of
System.out.println statement later.
Understanding Keywords
© paudyalsubash@yahoo.com 16
• At compile time, java file is compiled by Java Compiler and
converts the java code into bytecode.
• It does not interact with OS
What happens at compile time?
© paudyalsubash@yahoo.com 17
What happens at runtime?
© paudyalsubash@yahoo.com 18
• JVM (Java Virtual Machine) is an abstract machine. It is a specification
that provides runtime environment in which java bytecode can be
executed.
• JVMs are available for many hardware and software platforms. JVM,
JRE and JDK are platform dependent because configuration of each
OS differs. But, Java is platform independent.
• The JVM performs following main tasks:
• Loads code
• Verifies code
• Executes code
• Provides runtime environment
Difference between JVM, JRE and JDK
© paudyalsubash@yahoo.com 19
• JRE is an acronym for Java Runtime
Environment.It is used to provide
runtime environment.It is the
implementation of JVM.
• It physically exists. It contains set of
libraries + other files that JVM uses
at runtime.
• Implementation of JVMs are also
actively released by other
companies besides Sun Micro
Systems.
JRE
© paudyalsubash@yahoo.com 20
• JDK is an acronym
for Java
Development Kit.
• It physically exists.It
contains JRE +
development tools.
JDK
© paudyalsubash@yahoo.com 21
Java IDE
• Integrated Development Environment (IDE)
• Makes your work more productive
• Includes text editor, compiler, debugger, context sensitive, help,
works with different Java SDKs
• Most widely used IDEs:
• Netbeans (Oracle)
• Eclipse (Open)
• Intellijidea (Jetbrains)
© paudyalsubash@yahoo.com 22
• Queries?
End of Java Introduction
© paudyalsubash@yahoo.com 23

Mais conteúdo relacionado

Mais procurados

Java (Part 2) unit 1
Java (Part 2) unit 1Java (Part 2) unit 1
Java (Part 2) unit 1SURBHI SAROHA
 
JAVA ENVIRONMENT
JAVA  ENVIRONMENTJAVA  ENVIRONMENT
JAVA ENVIRONMENTjosemachoco
 
Introduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleIntroduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleSpringPeople
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programmingElizabeth Thomas
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAMehak Tawakley
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Rory Preddy
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)SURBHI SAROHA
 
Java basic-tutorial for beginners
Java basic-tutorial for beginners Java basic-tutorial for beginners
Java basic-tutorial for beginners Muzammil Ali
 
Java presentation
Java presentationJava presentation
Java presentationsurajdmk
 
Advantages of java
Advantages of javaAdvantages of java
Advantages of javaxxx007008
 

Mais procurados (20)

1 .java basic
1 .java basic1 .java basic
1 .java basic
 
Java (Part 2) unit 1
Java (Part 2) unit 1Java (Part 2) unit 1
Java (Part 2) unit 1
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
JAVA ENVIRONMENT
JAVA  ENVIRONMENTJAVA  ENVIRONMENT
JAVA ENVIRONMENT
 
Introduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleIntroduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeople
 
Java features
Java featuresJava features
Java features
 
Features of java 02
Features of java 02Features of java 02
Features of java 02
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVA
 
Java
JavaJava
Java
 
Lec 3 01_aug13
Lec 3 01_aug13Lec 3 01_aug13
Lec 3 01_aug13
 
JAVA FEATURES
JAVA FEATURESJAVA FEATURES
JAVA FEATURES
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
Java unit 1
Java unit 1Java unit 1
Java unit 1
 
Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
 
Java basic-tutorial for beginners
Java basic-tutorial for beginners Java basic-tutorial for beginners
Java basic-tutorial for beginners
 
Java presentation
Java presentationJava presentation
Java presentation
 
Presentation5
Presentation5Presentation5
Presentation5
 
Advantages of java
Advantages of javaAdvantages of java
Advantages of java
 

Semelhante a Java fundamentals

PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptRajeshSukte1
 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptCDSukte
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxJAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxSuganthiDPSGRKCW
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxMurugesh33
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxMurugesh33
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Java Lover
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to JavaSoumya Suman
 
Java Introduction | PDF
Java Introduction |  PDFJava Introduction |  PDF
Java Introduction | PDFGeekster
 
Introduction to Java Programming.pdf
Introduction to Java Programming.pdfIntroduction to Java Programming.pdf
Introduction to Java Programming.pdfAdiseshaK
 
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf10322210023
 

Semelhante a Java fundamentals (20)

PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
 
unit1.pptx
unit1.pptxunit1.pptx
unit1.pptx
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxJAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptx
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
 
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
 
1 java intro
1 java intro1 java intro
1 java intro
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
1.Intro--Why Java.pptx
1.Intro--Why Java.pptx1.Intro--Why Java.pptx
1.Intro--Why Java.pptx
 
Getting Started with JAVA
Getting Started with JAVAGetting Started with JAVA
Getting Started with JAVA
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1
 
Java introduction
Java introductionJava introduction
Java introduction
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java Introduction | PDF
Java Introduction |  PDFJava Introduction |  PDF
Java Introduction | PDF
 
Introduction to Java Programming.pdf
Introduction to Java Programming.pdfIntroduction to Java Programming.pdf
Introduction to Java Programming.pdf
 
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
 

Último

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Java fundamentals

  • 1. Instructor: @Subash @Paudyal Pokhara & Tribhuvan University Kathmandu, Nepal Training on Java Programming
  • 2. • Java Introduction • Java History • Why Learn Java • Java Version • Java IDE • Java Features • Java Program Structure • What happens at Compile and Runtime ? • Distinction between JVM, JRE and JDK Session 1: Fundamentals © paudyalsubash@yahoo.com 2
  • 3. • Java is a programming language and a platform. • Java is a high level, robust, secured and object-oriented programming language. Introduction (What java) © paudyalsubash@yahoo.com 3
  • 4. • James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. • Firstly, it was called "Greentalk" by James Gosling and file extension was .gt. • After that, it was called Oak and was developed as a part of the Green project. • Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like U.S.A., France, Germany, Romania etc. (presumably because he liked the look of an oak tree that was right outside his window at Sun). • In 1995, Oak was renamed as "Java" because it was already a trademark by Oak Technologies. • Why java? The team gathered to choose a new name. According to James Gosling "Java was one of the top choices along with Silk". Since java was so unique, most of the team members preferred java. • Java is an island of Indonesia where first coffee was produced (called java coffee). • Originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995. History (How Java) © paudyalsubash@yahoo.com 4
  • 5. Why Java? • Large codebase of already written applications • 9 million of professional Java developers • Lots of enterprise applications were developed and are being developed in Java • The same program can run on different platforms • Mobile Android development is done in Java • According to Sun, 3 billion devices run java. There are many devices where java is currently used. © paudyalsubash@yahoo.com 5
  • 6. • Some of the devices using java are as follows: • Desktop Applications such as acrobat reader, media player, antivirus etc. • Web Applications such as irctc.co.in, javatpoint.com etc. • Enterprise Applications such as banking applications. • Mobile • Embedded System • Smart Card • Robotics • Games etc. Devices using Java © paudyalsubash@yahoo.com 6
  • 7. • There are mainly 4 type of applications that can be created using java programming: • Standalone Application: (J2SE) – Standard Edition It is also known as desktop application or window-based application. An application that we need to install on every machine such as media player, antivirus etc. AWT and Swing are used in java for creating standalone applications. • Web Application: An application that runs on the server side and creates dynamic page, is called web application. Currently, servlet, jsp, struts, jsf etc. technologies are used for creating web applications in java. • Enterprise Application: (J2EE) – Enterprise Edition An application that is distributed in nature, such as banking applications etc. It has the advantage of high level security, load balancing and clustering. In java, EJB is used for creating enterprise applications. • Mobile Application: (J2ME) – Micro Edition An application that is created for mobile devices. Currently Android and Java ME are used for creating mobile applications. Types of Java Applications © paudyalsubash@yahoo.com 7
  • 8. • Simple • Object oriented • Platform independent • Secured • Multi-threaded • Robust • Portable • High Performance Features of Java © paudyalsubash@yahoo.com 8
  • 9. • syntax is based on C++ (so easier for programmers to learn it after C++). • removed many confusing and/or rarely-used features e.g., explicit pointers, operator overloading etc. • No need to remove unreferenced objects because there is Automatic Garbage Collection in java. Simple © paudyalsubash@yahoo.com 9
  • 10. • Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behaviour. • Object-oriented programming(OOPs) is a methodology that simplify software development and maintenance by providing some rules. • Basic concepts of OOPs are: • Object • Class • Inheritance • Polymorphism • Abstraction • Encapsulation Object Oriented © paudyalsubash@yahoo.com 10
  • 11. • A platform is the hardware or software environment in which a program runs. • There are two types of platforms software-based and hardware-based. • Java provides software-based platform. The Java platform differs from most other platforms in the sense that it's a software-based platform that runs on top of other hardware-based platforms. • It has two components: • Runtime Environment • API(Application Programming Interface) • java is platform independent Java code can be run on multiple platforms e.g.Windows,Linux,Sun Solaris,Mac/OS etc. • Java code is compiled by the compiler and converted into bytecode.This bytecode is a platform independent code because it can be run on multiple platforms i.e. Write Once and Run Anywhere(WORA). Platform Independent © paudyalsubash@yahoo.com 11
  • 13. • Java is secured because: • No explicit pointer • Programs run inside virtual machine sandbox. • Security provided by Java Language • Classloader • adds security by separating the package for the classes of the local file system from those that are imported from network sources. • Bytecode Verifier • checks the code fragments for illegal code that can violate access right to objects. • Security Manager • determines what resources a class can access such as reading and writing to the local disk. Secure © paudyalsubash@yahoo.com 13
  • 14. • A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it shares the same memory. Threads are important for multi-media, Web applications etc. • Robust simply means strong. Java uses strong memory management. There are lack of pointers that avoids security problem. There is automatic garbage collection in java. There is exception handling and type checking mechanism in java. All these points makes java robust. • We may carry the java bytecode to any platform. • Java is faster than traditional interpretation since byte code is "close" to native code still somewhat slower than a compiled language (e.g., C++) Multi-Tasking, Robust, Portable, high performance © paudyalsubash@yahoo.com 14
  • 15. Run First Program • Three steps to run the Java program  Write the program and save it in a file with the name that ends with .java, for example HelloWorld.java  Compile the program using javac compiler which creates HelloWorld.class file, for example javac HelloWorld.java  Run your program: java HelloWorld class HelloWorld { public static void main(String[] args) { System.out.println (“Hello, world!"); } } © paudyalsubash@yahoo.com 15
  • 16. • class keyword is used to declare a class in java. • public keyword is an access modifier which represents visibility, it means it is visible to all. • (if its not public JVM classes might not able to access it) • static is a keyword, if we declare any method as static, it is known as static method. The core advantage of static method is that there is no need to create object to invoke the static method. The main method is executed by the JVM, so it doesn't require to create object to invoke the main method. So it saves memory. • (While JVM tries to execute Java program it doesn't know how to create instance of main class as there is no standard constructor is defined for main class) • void is the return type of the method, it means it doesn't return any value. • (because it doesn't return any thing to caller which is JVM) • main represents startup of the program. • String[] args is used for command line argument. We will learn it later. • System.out.println() is used print statement. We will learn about the internal working of System.out.println statement later. Understanding Keywords © paudyalsubash@yahoo.com 16
  • 17. • At compile time, java file is compiled by Java Compiler and converts the java code into bytecode. • It does not interact with OS What happens at compile time? © paudyalsubash@yahoo.com 17
  • 18. What happens at runtime? © paudyalsubash@yahoo.com 18
  • 19. • JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed. • JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent. • The JVM performs following main tasks: • Loads code • Verifies code • Executes code • Provides runtime environment Difference between JVM, JRE and JDK © paudyalsubash@yahoo.com 19
  • 20. • JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM. • It physically exists. It contains set of libraries + other files that JVM uses at runtime. • Implementation of JVMs are also actively released by other companies besides Sun Micro Systems. JRE © paudyalsubash@yahoo.com 20
  • 21. • JDK is an acronym for Java Development Kit. • It physically exists.It contains JRE + development tools. JDK © paudyalsubash@yahoo.com 21
  • 22. Java IDE • Integrated Development Environment (IDE) • Makes your work more productive • Includes text editor, compiler, debugger, context sensitive, help, works with different Java SDKs • Most widely used IDEs: • Netbeans (Oracle) • Eclipse (Open) • Intellijidea (Jetbrains) © paudyalsubash@yahoo.com 22
  • 23. • Queries? End of Java Introduction © paudyalsubash@yahoo.com 23