SlideShare a Scribd company logo
1 of 31
Java Programming Language
Objectives


                •   In this session, you will learn to:
                       Describe the key features of Java technology
                       Write, compile, and run a simple Java technology application
                       Describe the function of the Java Virtual Machine
                       Define garbage collection
                       List the three tasks performed by the Java platform that handle
                       code security
                       Define modeling concepts: abstraction, encapsulation, and
                       packages
                       Discuss why you can reuse Java technology application code
                       Define class, member, attribute, method, constructor, and
                       package
                       Use the access modifiers private and public as appropriate for
                       the guidelines of encapsulation


     Ver. 1.0                            Session 1                            Slide 1 of 31
Java Programming Language
Objectives (Contd.)


                Invoke a method on a particular object
                Use the Java technology Application Programming Interface
                online documentation




     Ver. 1.0                    Session 1                          Slide 2 of 31
Java Programming Language
Key Features of Java Technology


                A programming language
                A development environment
                An application environment
                A deployment environment

                Java Technology is used for developing both applets and
                applications.




     Ver. 1.0                     Session 1                        Slide 3 of 31
Java Programming Language
Primary Goals of the Java Technology


                Provides an easy-to-use language by:
                   Avoiding many pitfalls of other languages
                   Being object-oriented
                   Enables code streamlining
                Provides an interpreted environment for:
                   Improved speed of development
                   Code portability
                Loads classes dynamically, i.e., at the time they are actually
                needed
                Supports changing programs dynamically during runtime by
                loading classes from distinct sources
                Furnishes better security
                Enable users to run more than one thread of an activity


     Ver. 1.0                       Session 1                         Slide 4 of 31
Java Programming Language
Primary Features of the Java Technology


                The Java Virtual Machine (JVM™)
                Garbage collection
                The Java Runtime Environment (JRE)
                JVM tool interface




     Ver. 1.0                    Session 1           Slide 5 of 31
Java Programming Language
The Java Virtual Machine


                JVM provides definitions for the:
                   Instruction set (Central Processing Unit [CPU])
                   Register set
                   Class file format
                   Runtime stack
                   Garbage-collected heap
                   Memory area
                   Fatal error reporting mechanism
                   High-precision timing support




     Ver. 1.0                        Session 1                       Slide 6 of 31
Java Programming Language
Garbage Collection


                Garbage collection has the following characteristics:
                   Checks for and frees memory no longer needed, automatically.
                   Provides a system-level thread to track memory allocation.




     Ver. 1.0                       Session 1                           Slide 7 of 31
Java Programming Language
The Java Runtime Environment


               • The Java application environment performs as follows:




    Ver. 1.0                         Session 1                       Slide 8 of 31
Java Programming Language
JVM™ Tasks


               The JVM performs three main tasks:
                  Loads code – Performed by the class loader.
                  Verifies code – Performed by the bytecode verifier.
                  Executes code – Performed by the runtime interpreter.




    Ver. 1.0                       Session 1                              Slide 9 of 31
Java Programming Language
The Class Loader


                Loads all classes necessary for the execution of a program.
                Maintains classes of the local file system in separate
                namespaces.
                Avoids execution of the program whose bytecode has been
                changed illegally.




     Ver. 1.0                      Session 1                        Slide 10 of 31
Java Programming Language
The Bytecode Verifier


                All class files imported across the network pass through the
                bytecode verifier, which ensures that:
                   The code adheres to the JVM specification.
                   The code does not violate system integrity.
                   The code causes no operand stack overflows or underflows.
                   The parameter types for all operational code are correct.
                   No illegal data conversions (the conversion of integers to
                   pointers) have occurred.




     Ver. 1.0                       Session 1                          Slide 11 of 31
Java Programming Language
Java Technology Runtime Environment




     Ver. 1.0              Session 1   Slide 12 of 31
Java Programming Language
A simple Java Application


                Let see how to create a simple Java Application.




     Ver. 1.0                         Session 1                    Slide 13 of 31
Java Programming Language
The Analysis and Design Phase


                Analysis describes what the system needs to do:
                   Modeling the real-world, including actors and activities, objects,
                   and behaviors.
                Design describes how the system does it:
                   Modeling the relationships and interactions between objects
                   and actors in the system.
                Finding useful abstractions to help simplify the problem or
                solution.




     Ver. 1.0                        Session 1                              Slide 14 of 31
Java Programming Language
Declaring Java Technology Classes


                Basic syntax of a Java class:
                 <modifier>* class <class_name>
                 { <attribute_declaration>*
                   <constructor_declaration>*
                   <method_declaration>*
                 }
                Example:
                 public class MyFirstClass
                 { private int age;
                   public void setAge(int value)
                   { age = value;
                   }
                 }
     Ver. 1.0                 Session 1            Slide 15 of 31
Java Programming Language
Declaring Attributes


                Basic syntax of an attribute:
                 <modifier>* <type> <name> [ =
                 <initial_value>];
                Example:
                 public class MyFirstClass
                 {
                     private int x;
                     private float y = 10000.0F;
                     private String name = “NIIT";
                 }




     Ver. 1.0                  Session 1             Slide 16 of 31
Java Programming Language
Declaring Methods


                Basic syntax of a method:
                 <modifier>* <return_type> <name>
                 ( <argument>* ){         <statement>* }
                Example:
                 public class Dog
                 { private int weight;
                     public int getWeight()
                     { return weight;
                     }
                     public void setWeight(int newWeight)
                     { if ( newWeight > 0 )
                         { weight = newWeight;
                     } } }

     Ver. 1.0                  Session 1                Slide 17 of 31
Java Programming Language
Accessing Object Members


               To access object members, including attributes and
               methods, dot notation is used
                  The dot notation is: <object>.<member>
                  Examples:
                   d.setWeight(42);
                   d.weight = 42;           // only permissible if weight is public




    Ver. 1.0                        Session 1                              Slide 18 of 31
Java Programming Language
Class Representation Using UML


                • Class representation of MyDate class:

                     MyDate                       Class name

                     -day : int
                     -month : int                   Attributes
                     -year : int

                     +getDay()
                     +getMonth()
                     +getYear()                                  Methods
                     +setDay(int) : boolean
                     +setMonth(int) : boolean
                     +setYear(int) : boolean

     Ver. 1.0                         Session 1                            Slide 19 of 31
Java Programming Language
Abstraction


                Abstraction means ignoring the non-essential details of an
                object and concentrating on its essential details.




     Ver. 1.0                      Session 1                        Slide 20 of 31
Java Programming Language
Encapsulation


                Encapsulation provides data representation flexibility by:
                   Hiding the implementation details of a class.
                   Forcing the user to use an interface to access data.
                   Making the code more maintainable.




     Ver. 1.0                        Session 1                            Slide 21 of 31
Java Programming Language
Declaring Constructors


                •   A constructor is a set of instructions designed to initialize an
                    instance.
                •   Basic syntax of a constructor:
                     [<modifier>] <class_name> ( <argument>* )
                     { <statement>* }
                    Example:
                     public class Dog
                     { private int weight;
                         public Dog()
                         { weight = 42;
                         }
                     }


     Ver. 1.0                            Session 1                          Slide 22 of 31
Java Programming Language
The Default Constructor


                There is always at least one constructor in every class.
                If the programmer does not supply any constructor, the
                default constructor is present automatically.
                The characteristics of default constructor:
                 – The default constructor takes no arguments.
                 – The default constructor body is empty.
                 – The default constructor enables you to create object instances
                   with new xyz() without having to write a constructor.




     Ver. 1.0                        Session 1                           Slide 23 of 31
Java Programming Language
Source File Layout


                Basic syntax of a Java source file:
                 [<package_declaration>]
                 <import_declaration>*
                 <class_declaration>+
                For example, the VehicleCapacityReport.java file can be
                written as:
                 package shipping.reports;
                 import shipping.domain.*;
                 import java.util.List;
                 import java.io.*;
                 public class VehicleCapacityReport
                 { private List vehicles;
                    public void generateReport(Writer output)
                    {...} }


     Ver. 1.0                     Session 1                     Slide 24 of 31
Java Programming Language
Software Packages


               • Packages help manage large software systems.
               • Packages can contain classes and sub-packages.




    Ver. 1.0                      Session 1                       Slide 25 of 31
Java Programming Language
Software Packages (Contd.)


                Basic syntax of the import statement:
                 import
                 <pkg_name>[.<sub_pkg_name>]*.<class_name>;
                or
                 import <pkg_name>[.<sub_pkg_name>]*.*;
                Examples:
                import java.util.List;
                import java.io.*;
                import shipping.gui.reportscreens.*;
                The import statement does the following:
                  Precedes all class declarations
                  Tells the compiler where to find classes


     Ver. 1.0                       Session 1                Slide 26 of 31
Java Programming Language
Deployment


               In order to deploy an application without manipulating the
               user’s CLASSPATH environment variable, create an
               executable Java Archive (JAR) File.
               To deploy library code in a JAR file, copy the JAR file into
               the ext subdirectory of the lib directory in the main directory
               of the JRE.




    Ver. 1.0                       Session 1                           Slide 27 of 31
Java Programming Language
Using the Java Technology API Documentation


                The main sections of a class document include the
                following:
                – The class hierarchy
                – A description of the class and its general purpose
                – A list of attributes
                – A list of constructors
                – A list of methods
                – A detailed list of attributes with descriptions
                – A detailed list of constructors with descriptions and formal
                  parameter lists
                – A detailed list of methods with descriptions and formal
                  parameter lists




     Ver. 1.0                        Session 1                             Slide 28 of 31
Java Programming Language
Summary


               In this session, you learned that:
                  The key features of Java technology include:
                    •   A programming language
                    •   A development environment
                    •   An application environment
                    •   A deployment environment
                  JVM can be defined as an imaginary machine that is
                  implemented by emulating it in software on a real machine.
                  Java source files are compiled, get converted into a bytecode
                  file. At runtime, the bytecodes are loaded, checked, and run in
                  an interpreter.
                  Garbage collector checks for and frees memory no longer
                  needed, automatically.




    Ver. 1.0                          Session 1                          Slide 29 of 31
Java Programming Language
Summary (Contd.)


               The three main tasks performed by the JVM include:
                • Loads code
                • Verifies code
                • Executes code
               There are five primary workflows in a software development
               project: Requirement capture, Analysis, Design,
               Implementation, and Test.
               Abstraction means ignoring the non-essential details of an
               object and concentrating on its essential details.
               Encapsulation provides data representation flexibility by hiding
               the implementation details of a class.
               The Java technology class can be declared by using the
               declaration:
                 <modifier> * class <class name>
               The declaration of a Java object attribute can be done as:
                 <modifier> * <type> <name>
    Ver. 1.0                      Session 1                            Slide 30 of 31
Java Programming Language
Summary (Contd.)


                   The definition of methods can be done as:
                      <modifier> * <return type> <name> (<argument>
                        *)
               –   The dot operator enables you to access non-private attribute
                   and method members of a class.
               –   A constructor is a set of instructions designed to initialize an
                   instance of a class.
               –   The Java technology programming language provides the
                   package statement as a way to group related classes.
               –   The import statement tells the compiler where to find the
                   classes which are grouped in packages.
               –   The Java technology API consists of a set of HTML files. This
                   documentation has a hierarchical layout, where the home page
                   lists all the packages as hyperlinks.



    Ver. 1.0                         Session 1                            Slide 31 of 31

More Related Content

What's hot

01 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_0101 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_01Niit Care
 
09 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_1309 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_13Niit Care
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05Niit Care
 
07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10Niit Care
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08Niit Care
 
05 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_0705 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_07Niit Care
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsMahika Tutorials
 
11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16Niit Care
 
10 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_1410 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_14Niit Care
 
12 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_1712 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_17Niit Care
 

What's hot (20)

01 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_0101 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_01
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
09 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_1309 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_13
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05
 
Java basic
Java basicJava basic
Java basic
 
07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08
 
05 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_0705 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_07
 
Unit 2 Java
Unit 2 JavaUnit 2 Java
Unit 2 Java
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika Tutorials
 
Java features
Java featuresJava features
Java features
 
01 gui 01
01 gui 0101 gui 01
01 gui 01
 
Java swing 1
Java swing 1Java swing 1
Java swing 1
 
11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
10 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_1410 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_14
 
Programming in Java
Programming in JavaProgramming in Java
Programming in Java
 
Java basic introduction
Java basic introductionJava basic introduction
Java basic introduction
 
12 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_1712 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_17
 
.NET Vs J2EE
.NET Vs J2EE.NET Vs J2EE
.NET Vs J2EE
 

Viewers also liked

Intuit commissions manager
Intuit commissions managerIntuit commissions manager
Intuit commissions managersshhzap
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overviewJong Soon Bok
 
Jena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for JavaJena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for JavaAleksander Pohl
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with JavaJussi Pohjolainen
 
Object-Oriented Analysis And Design With Applications Grady Booch
Object-Oriented Analysis And Design With Applications Grady BoochObject-Oriented Analysis And Design With Applications Grady Booch
Object-Oriented Analysis And Design With Applications Grady BoochSorina Chirilă
 

Viewers also liked (9)

Intuit commissions manager
Intuit commissions managerIntuit commissions manager
Intuit commissions manager
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
Java Basics
Java BasicsJava Basics
Java Basics
 
02 basic java programming and operators
02 basic java programming and operators02 basic java programming and operators
02 basic java programming and operators
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
Jena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for JavaJena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for Java
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Object-Oriented Analysis And Design With Applications Grady Booch
Object-Oriented Analysis And Design With Applications Grady BoochObject-Oriented Analysis And Design With Applications Grady Booch
Object-Oriented Analysis And Design With Applications Grady Booch
 

Similar to Java Programming Language Objectives

What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)Shaharyar khan
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVAHome
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to JavaDevaKumari Vijay
 
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Soumen Santra
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1Qualys
 
02-Java Technology Details.ppt
02-Java Technology Details.ppt02-Java Technology Details.ppt
02-Java Technology Details.pptJyothiAmpally
 
Vb.net basics 1(vb,net--3 year)
Vb.net basics 1(vb,net--3 year)Vb.net basics 1(vb,net--3 year)
Vb.net basics 1(vb,net--3 year)Ankit Gupta
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCFAKHRUN NISHA
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting StartedRakesh Madugula
 

Similar to Java Programming Language Objectives (20)

What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
 
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
 
Java solution
Java solutionJava solution
Java solution
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Java Tutorial 1
Java Tutorial 1Java Tutorial 1
Java Tutorial 1
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1
 
02-Java Technology Details.ppt
02-Java Technology Details.ppt02-Java Technology Details.ppt
02-Java Technology Details.ppt
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Javamschn3
Javamschn3Javamschn3
Javamschn3
 
Vb.net basics 1(vb,net--3 year)
Vb.net basics 1(vb,net--3 year)Vb.net basics 1(vb,net--3 year)
Vb.net basics 1(vb,net--3 year)
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting Started
 
Java Notes
Java Notes Java Notes
Java Notes
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Java Programming Language Objectives

  • 1. Java Programming Language Objectives • In this session, you will learn to: Describe the key features of Java technology Write, compile, and run a simple Java technology application Describe the function of the Java Virtual Machine Define garbage collection List the three tasks performed by the Java platform that handle code security Define modeling concepts: abstraction, encapsulation, and packages Discuss why you can reuse Java technology application code Define class, member, attribute, method, constructor, and package Use the access modifiers private and public as appropriate for the guidelines of encapsulation Ver. 1.0 Session 1 Slide 1 of 31
  • 2. Java Programming Language Objectives (Contd.) Invoke a method on a particular object Use the Java technology Application Programming Interface online documentation Ver. 1.0 Session 1 Slide 2 of 31
  • 3. Java Programming Language Key Features of Java Technology A programming language A development environment An application environment A deployment environment Java Technology is used for developing both applets and applications. Ver. 1.0 Session 1 Slide 3 of 31
  • 4. Java Programming Language Primary Goals of the Java Technology Provides an easy-to-use language by: Avoiding many pitfalls of other languages Being object-oriented Enables code streamlining Provides an interpreted environment for: Improved speed of development Code portability Loads classes dynamically, i.e., at the time they are actually needed Supports changing programs dynamically during runtime by loading classes from distinct sources Furnishes better security Enable users to run more than one thread of an activity Ver. 1.0 Session 1 Slide 4 of 31
  • 5. Java Programming Language Primary Features of the Java Technology The Java Virtual Machine (JVM™) Garbage collection The Java Runtime Environment (JRE) JVM tool interface Ver. 1.0 Session 1 Slide 5 of 31
  • 6. Java Programming Language The Java Virtual Machine JVM provides definitions for the: Instruction set (Central Processing Unit [CPU]) Register set Class file format Runtime stack Garbage-collected heap Memory area Fatal error reporting mechanism High-precision timing support Ver. 1.0 Session 1 Slide 6 of 31
  • 7. Java Programming Language Garbage Collection Garbage collection has the following characteristics: Checks for and frees memory no longer needed, automatically. Provides a system-level thread to track memory allocation. Ver. 1.0 Session 1 Slide 7 of 31
  • 8. Java Programming Language The Java Runtime Environment • The Java application environment performs as follows: Ver. 1.0 Session 1 Slide 8 of 31
  • 9. Java Programming Language JVM™ Tasks The JVM performs three main tasks: Loads code – Performed by the class loader. Verifies code – Performed by the bytecode verifier. Executes code – Performed by the runtime interpreter. Ver. 1.0 Session 1 Slide 9 of 31
  • 10. Java Programming Language The Class Loader Loads all classes necessary for the execution of a program. Maintains classes of the local file system in separate namespaces. Avoids execution of the program whose bytecode has been changed illegally. Ver. 1.0 Session 1 Slide 10 of 31
  • 11. Java Programming Language The Bytecode Verifier All class files imported across the network pass through the bytecode verifier, which ensures that: The code adheres to the JVM specification. The code does not violate system integrity. The code causes no operand stack overflows or underflows. The parameter types for all operational code are correct. No illegal data conversions (the conversion of integers to pointers) have occurred. Ver. 1.0 Session 1 Slide 11 of 31
  • 12. Java Programming Language Java Technology Runtime Environment Ver. 1.0 Session 1 Slide 12 of 31
  • 13. Java Programming Language A simple Java Application Let see how to create a simple Java Application. Ver. 1.0 Session 1 Slide 13 of 31
  • 14. Java Programming Language The Analysis and Design Phase Analysis describes what the system needs to do: Modeling the real-world, including actors and activities, objects, and behaviors. Design describes how the system does it: Modeling the relationships and interactions between objects and actors in the system. Finding useful abstractions to help simplify the problem or solution. Ver. 1.0 Session 1 Slide 14 of 31
  • 15. Java Programming Language Declaring Java Technology Classes Basic syntax of a Java class: <modifier>* class <class_name> { <attribute_declaration>* <constructor_declaration>* <method_declaration>* } Example: public class MyFirstClass { private int age; public void setAge(int value) { age = value; } } Ver. 1.0 Session 1 Slide 15 of 31
  • 16. Java Programming Language Declaring Attributes Basic syntax of an attribute: <modifier>* <type> <name> [ = <initial_value>]; Example: public class MyFirstClass { private int x; private float y = 10000.0F; private String name = “NIIT"; } Ver. 1.0 Session 1 Slide 16 of 31
  • 17. Java Programming Language Declaring Methods Basic syntax of a method: <modifier>* <return_type> <name> ( <argument>* ){ <statement>* } Example: public class Dog { private int weight; public int getWeight() { return weight; } public void setWeight(int newWeight) { if ( newWeight > 0 ) { weight = newWeight; } } } Ver. 1.0 Session 1 Slide 17 of 31
  • 18. Java Programming Language Accessing Object Members To access object members, including attributes and methods, dot notation is used The dot notation is: <object>.<member> Examples: d.setWeight(42); d.weight = 42; // only permissible if weight is public Ver. 1.0 Session 1 Slide 18 of 31
  • 19. Java Programming Language Class Representation Using UML • Class representation of MyDate class: MyDate Class name -day : int -month : int Attributes -year : int +getDay() +getMonth() +getYear() Methods +setDay(int) : boolean +setMonth(int) : boolean +setYear(int) : boolean Ver. 1.0 Session 1 Slide 19 of 31
  • 20. Java Programming Language Abstraction Abstraction means ignoring the non-essential details of an object and concentrating on its essential details. Ver. 1.0 Session 1 Slide 20 of 31
  • 21. Java Programming Language Encapsulation Encapsulation provides data representation flexibility by: Hiding the implementation details of a class. Forcing the user to use an interface to access data. Making the code more maintainable. Ver. 1.0 Session 1 Slide 21 of 31
  • 22. Java Programming Language Declaring Constructors • A constructor is a set of instructions designed to initialize an instance. • Basic syntax of a constructor: [<modifier>] <class_name> ( <argument>* ) { <statement>* } Example: public class Dog { private int weight; public Dog() { weight = 42; } } Ver. 1.0 Session 1 Slide 22 of 31
  • 23. Java Programming Language The Default Constructor There is always at least one constructor in every class. If the programmer does not supply any constructor, the default constructor is present automatically. The characteristics of default constructor: – The default constructor takes no arguments. – The default constructor body is empty. – The default constructor enables you to create object instances with new xyz() without having to write a constructor. Ver. 1.0 Session 1 Slide 23 of 31
  • 24. Java Programming Language Source File Layout Basic syntax of a Java source file: [<package_declaration>] <import_declaration>* <class_declaration>+ For example, the VehicleCapacityReport.java file can be written as: package shipping.reports; import shipping.domain.*; import java.util.List; import java.io.*; public class VehicleCapacityReport { private List vehicles; public void generateReport(Writer output) {...} } Ver. 1.0 Session 1 Slide 24 of 31
  • 25. Java Programming Language Software Packages • Packages help manage large software systems. • Packages can contain classes and sub-packages. Ver. 1.0 Session 1 Slide 25 of 31
  • 26. Java Programming Language Software Packages (Contd.) Basic syntax of the import statement: import <pkg_name>[.<sub_pkg_name>]*.<class_name>; or import <pkg_name>[.<sub_pkg_name>]*.*; Examples: import java.util.List; import java.io.*; import shipping.gui.reportscreens.*; The import statement does the following: Precedes all class declarations Tells the compiler where to find classes Ver. 1.0 Session 1 Slide 26 of 31
  • 27. Java Programming Language Deployment In order to deploy an application without manipulating the user’s CLASSPATH environment variable, create an executable Java Archive (JAR) File. To deploy library code in a JAR file, copy the JAR file into the ext subdirectory of the lib directory in the main directory of the JRE. Ver. 1.0 Session 1 Slide 27 of 31
  • 28. Java Programming Language Using the Java Technology API Documentation The main sections of a class document include the following: – The class hierarchy – A description of the class and its general purpose – A list of attributes – A list of constructors – A list of methods – A detailed list of attributes with descriptions – A detailed list of constructors with descriptions and formal parameter lists – A detailed list of methods with descriptions and formal parameter lists Ver. 1.0 Session 1 Slide 28 of 31
  • 29. Java Programming Language Summary In this session, you learned that: The key features of Java technology include: • A programming language • A development environment • An application environment • A deployment environment JVM can be defined as an imaginary machine that is implemented by emulating it in software on a real machine. Java source files are compiled, get converted into a bytecode file. At runtime, the bytecodes are loaded, checked, and run in an interpreter. Garbage collector checks for and frees memory no longer needed, automatically. Ver. 1.0 Session 1 Slide 29 of 31
  • 30. Java Programming Language Summary (Contd.) The three main tasks performed by the JVM include: • Loads code • Verifies code • Executes code There are five primary workflows in a software development project: Requirement capture, Analysis, Design, Implementation, and Test. Abstraction means ignoring the non-essential details of an object and concentrating on its essential details. Encapsulation provides data representation flexibility by hiding the implementation details of a class. The Java technology class can be declared by using the declaration: <modifier> * class <class name> The declaration of a Java object attribute can be done as: <modifier> * <type> <name> Ver. 1.0 Session 1 Slide 30 of 31
  • 31. Java Programming Language Summary (Contd.) The definition of methods can be done as: <modifier> * <return type> <name> (<argument> *) – The dot operator enables you to access non-private attribute and method members of a class. – A constructor is a set of instructions designed to initialize an instance of a class. – The Java technology programming language provides the package statement as a way to group related classes. – The import statement tells the compiler where to find the classes which are grouped in packages. – The Java technology API consists of a set of HTML files. This documentation has a hierarchical layout, where the home page lists all the packages as hyperlinks. Ver. 1.0 Session 1 Slide 31 of 31