SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Connect. Collaborate. Innovate.




                               Java Programming Basic
                                      Concepts



                                    Learning Facilitator:
                                           Date:




© Copyright GlobalLogic 2009                                                    1
Connect. Collaborate. Innovate.




                                     Gentle Reminder:
                                 “Switch Off” your Mobile Phone
                                               Or
                               Switch Mobile Phone to “Silent Mode”




© Copyright GlobalLogic 2009                                                             2
Connect. Collaborate. Innovate.




                Agenda

                •     What JAVA is for?
                         –     Software Portability
                         –     Why Portability Matters
                         –     Language and Libraries


                •     Basic Concepts
                         –     JVM, Classpath
                         –     Packages
                         –     Data Types
                         –     JavaDoc/Comments
                         –     Garbage Collection


                • Example Java Application



© Copyright GlobalLogic 2009                                                           3
                                                                                       3
Connect. Collaborate. Innovate.




                What JAVA does for you?


                • Hardware Systems
                         – Processor + memory + I/O devices
                               (Platform to execute softwares)

                • Operating Systems
                         – An operating system (OS) is a set of computer programs that manage
                           the hardware and software resources of a computer.
                         – Runs on top of hardware, so tightly attached with the hardware

                • Application Softwares
                         – Runs on top of operating system, a subclass of computer software
                           which address a particular objective e.g. Word-processors ..
                         – Application made for one OS/hardware system may not run on
                           another.
© Copyright GlobalLogic 2009                                                                           4
                                                                                                       4
Connect. Collaborate. Innovate.




                Why Portability?


                • Softwares Portability

                                    “Applications that are independent of all hardware
                                                 and operating systems”

                         You can compile a Java program on any system and run the
                         resulting binary executable file on the same or any other system

                • “Software portability” refers to adapting a software to a new
                  environment, without re-developing it. This reduces the re-
                  development efforts.




© Copyright GlobalLogic 2009                                                                             5
                                                                                                         5
Connect. Collaborate. Innovate.




                Why Portability?


                • There are different hardware and operating systems
                • Even for one OS, there are numerous releases



                • Software portability is all about “Future-proofing” your
                         Software investment
                         “Future proofing” is a process of trying to anticipate future
                           developments, so that appropriate actions can be taken to minimize
                           negative consequences.
                • With application programs written in Java, you can
                         change/upgrade OS and applications independently




© Copyright GlobalLogic 2009                                                                           6
                                                                                                       6
Connect. Collaborate. Innovate.




                • Example C program
                               void main()
                               {
                                   int arr[2];
                                   printf(“%dn”, arr*3+);
                               }

                               • Run this on windows (using turbo c)
                               • Run this on Unix (using gcc)
                               • Compare the results




© Copyright GlobalLogic 2009                                                                         7
                                                                                                     7
Connect. Collaborate. Innovate.




                Language & Libraries


                • A “programming language” is about
                         – Describing DATA
                         – Describing STATEMENTS that work on DATA
                         – Describing the ways the two can be put together
                               • How expressions are formed
                               • What statements look like
                • Java is a Object-oriented, strongly typed language.
                         – Strongly typed languages specify one or more restrictions on how
                           operations involving values having different data types can be
                           intermixed.
                • Library (package)
                         – Frequently reused code
                         – Not an executable program, but contains executable code
                         – Linking with program's address space
© Copyright GlobalLogic 2009                                                                               8
                                                                                                           8
Connect. Collaborate. Innovate.




                JVM


                • A virtual machine (VM) is an abstract computer architecture
                • Software on top of a real hardware
                • Can run the same application on different machines where the VM
                  is available
                           Java program                               C program v1         C program v2


                               Compiler
                                                                   C compiler and executor 1

                         JVM 1            JVM 2    JVM 3                        C compiler and executor 2



                                      Platform 1      Platform 2   Platform 3




© Copyright GlobalLogic 2009                                                                                          9
                                                                                                                      9
Connect. Collaborate. Innovate.




                •     Java source code is compiled to byte-codes whose target architecture is
                      the Java Virtual Machine (JVM)
                •     Just-in-time (JIT) compiler provides compilation of byte-code to
                      machine code




© Copyright GlobalLogic 2009                                                                         10
                                                                                                     10
Connect. Collaborate. Innovate.




© Copyright GlobalLogic 2009                                 11
                                                             11
Connect. Collaborate. Innovate.



                Exercise


                • Write a Java program to print “Hello World!!!” on the command
                  prompt
                         (Use notepad)

                         – Compile the program
                         – Run the program




© Copyright GlobalLogic 2009                                                                 12
                                                                                             12
Connect. Collaborate. Innovate.




                Classpath


                • The Classpath is an argument (Environment variable) that tells the
                  Java Virtual Machine where to look for user-defined classes and
                  packages in Java programs.

                • Setting CLASSPATH from command-line
                               SET CLASSPATH=Dir;

                • Setting CLASSPATH in Windows via Control-panel




© Copyright GlobalLogic 2009                                                                   13
                                                                                               13
Connect. Collaborate. Innovate.



                Exercise


                • Revisit the hello world program

                • Compiling and running the program from any other directory




© Copyright GlobalLogic 2009                                                                 14
                                                                                             14
Connect. Collaborate. Innovate.




                Java Packages


                • A Java package is a mechanism for organizing Java classes into
                  namespaces.
                • A package provides a unique namespace for the types it contains.
                • Classes in the same package can access each other's protected
                  members.
                • Packages are usually defined using a hierarchical naming pattern
                               • Example – java.lang.*, com.globallogic.*




© Copyright GlobalLogic 2009                                                                              15
                                                                                                          15
Connect. Collaborate. Innovate.



                Exercise


                • Move the hello world program in a package
                                   com.globallogic.training.java

                               • Now compile and execute the program




© Copyright GlobalLogic 2009                                                                         16
                                                                                                     16
Connect. Collaborate. Innovate.




                Data Types


                • A data type is a set of values and the operations on those values
                         – For example, the Java "int" type is the set of 32-bit integers together
                           with the operations "+", "*", "%", etc that operate over integers
                • A data type describes representation, interpretation and structure
                  of values manipulated by algorithms or objects stored in computer
                  memory or other storage device
                • Java has two groups of data types, primitive data types and object
                  references.
                         – primitive data types store actual data,
                         – Java object references are variables which hold references to objects




© Copyright GlobalLogic 2009                                                                                17
                                                                                                            17
Connect. Collaborate. Innovate.



                Data Types


                • Arrays
                                    int[] anArray;
                                    anArray = new int[10];
                                          OR
                                    int[] anArray = new int[10];
                • String
                               String greeting = "Hello world!";

                         character array
                               char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.'};
                               String helloString = new String(helloArray);
                         Basic operations
                               length
                               concat
                               substr
                • int, float
© Copyright GlobalLogic 2009                                                                                        18
                                                                                                                    18
Connect. Collaborate. Innovate.



                Basic I/O


                • I/O streams
                               • An I/O Stream represents an input source or an output destination. A
                                 stream can represent many different kinds of sources and destinations,
                                 including disk files, devices, other programs, and memory arrays.
                               • Input stream
                               • Output stream

                • Writing on console
                                   System.out.println(“...”);


                • Reading from console
                               BufferedReader in = new BufferedReader(new
                                  InputStreamReader(System.in));
                               in.readLine();



© Copyright GlobalLogic 2009                                                                                    19
                                                                                                                19
Connect. Collaborate. Innovate.



                Exercise


                • To determine whether a given string is a palindrome.
                         – Input : a String to be read from console
                         – Ouptput: true/false




© Copyright GlobalLogic 2009                                                                        20
                                                                                                    20
Connect. Collaborate. Innovate.




                Garbage Collection


                • Garbage collection (GC) is a form of automatic memory
                  management.

                • The garbage collector or collector attempts to reclaim garbage, or
                  memory used by objects that will never be accessed the application

                • The basic principle of how a garbage collector works is:
                         – Determine what data objects in a program will not be accessed in the
                           future
                         – Reclaim the resources used by those objects

                • A key feature of Java is its garbage-collected heap, which takes care
                  of freeing dynamically allocated memory that is no longer
                  referenced.
© Copyright GlobalLogic 2009                                                                             21
                                                                                                         21
Connect. Collaborate. Innovate.




                JavaDoc/Comments


                Java comments are of three types
                         – Line Comment //line comment
                         – Block Comment /* block comment */
                         – JavaDoc Comment
                               /**
                               * ...
                               */

                • Javadoc is a tool for generating API documentation in HTML format
                  from doc comments in source code




© Copyright GlobalLogic 2009                                                                 22
                                                                                             22
Connect. Collaborate. Innovate.




                               Q&A


© Copyright GlobalLogic 2009                                       23
Connect. Collaborate. Innovate.




                    “Thank You” for your learning contribution!


           Please submit feedback to help L&D make continuous
           improvement……

             Dial @ Learning:
             Noida: 4444, Nagpur:333, Pune:5222, Banglore:111

             E mail: learning@globallogic.com


© Copyright GlobalLogic 2009                                                                  24

Más contenido relacionado

La actualidad más candente

UnBBayes Plugin Framework
UnBBayes Plugin FrameworkUnBBayes Plugin Framework
UnBBayes Plugin FrameworkRommel Carvalho
 
Vsx5 getting started_guide_en
Vsx5 getting started_guide_enVsx5 getting started_guide_en
Vsx5 getting started_guide_enGeraldo Camargo
 
Sv jug - mar 2013 - sl
Sv jug - mar 2013 - slSv jug - mar 2013 - sl
Sv jug - mar 2013 - slCloudBees
 
Squeeze more juice from jenkins
Squeeze more juice from jenkinsSqueeze more juice from jenkins
Squeeze more juice from jenkinsCloudBees
 
PowerPoint Presentation
PowerPoint PresentationPowerPoint Presentation
PowerPoint Presentationrhofkens
 
Subversion Edge Overview
Subversion Edge OverviewSubversion Edge Overview
Subversion Edge OverviewLotharSchubert
 
Quality Best Practices & Toolkit for Enterprise Flex
Quality Best Practices & Toolkit for Enterprise FlexQuality Best Practices & Toolkit for Enterprise Flex
Quality Best Practices & Toolkit for Enterprise FlexFrançois Le Droff
 
Alliance Successful Selenium Automation
Alliance Successful Selenium AutomationAlliance Successful Selenium Automation
Alliance Successful Selenium Automationsadams22
 
AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...
AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...
AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...Stephan H. Wissel
 

La actualidad más candente (9)

UnBBayes Plugin Framework
UnBBayes Plugin FrameworkUnBBayes Plugin Framework
UnBBayes Plugin Framework
 
Vsx5 getting started_guide_en
Vsx5 getting started_guide_enVsx5 getting started_guide_en
Vsx5 getting started_guide_en
 
Sv jug - mar 2013 - sl
Sv jug - mar 2013 - slSv jug - mar 2013 - sl
Sv jug - mar 2013 - sl
 
Squeeze more juice from jenkins
Squeeze more juice from jenkinsSqueeze more juice from jenkins
Squeeze more juice from jenkins
 
PowerPoint Presentation
PowerPoint PresentationPowerPoint Presentation
PowerPoint Presentation
 
Subversion Edge Overview
Subversion Edge OverviewSubversion Edge Overview
Subversion Edge Overview
 
Quality Best Practices & Toolkit for Enterprise Flex
Quality Best Practices & Toolkit for Enterprise FlexQuality Best Practices & Toolkit for Enterprise Flex
Quality Best Practices & Toolkit for Enterprise Flex
 
Alliance Successful Selenium Automation
Alliance Successful Selenium AutomationAlliance Successful Selenium Automation
Alliance Successful Selenium Automation
 
AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...
AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...
AD114 - Don't be afraid of curly brackets reloaded - even more JavaScript for...
 

Destacado (17)

Gl qtp day 3 2
Gl qtp day 3   2Gl qtp day 3   2
Gl qtp day 3 2
 
Social guide to_link_building
Social guide to_link_buildingSocial guide to_link_building
Social guide to_link_building
 
Gl qtp day 1 & 2
Gl qtp   day 1 & 2Gl qtp   day 1 & 2
Gl qtp day 1 & 2
 
How to-segment-integrate-your-emails-fin
How to-segment-integrate-your-emails-finHow to-segment-integrate-your-emails-fin
How to-segment-integrate-your-emails-fin
 
70562-Dumps
70562-Dumps70562-Dumps
70562-Dumps
 
A1
A1A1
A1
 
Index Grey (1)
Index Grey (1)Index Grey (1)
Index Grey (1)
 
32916
3291632916
32916
 
70 433
70 43370 433
70 433
 
18 octubre2007 borinbizkarra
18 octubre2007 borinbizkarra18 octubre2007 borinbizkarra
18 octubre2007 borinbizkarra
 
120 marketing-stats-charts-and-graphs
120 marketing-stats-charts-and-graphs120 marketing-stats-charts-and-graphs
120 marketing-stats-charts-and-graphs
 
After midsem-slides-1224252673846877-9 nirav
After midsem-slides-1224252673846877-9 niravAfter midsem-slides-1224252673846877-9 nirav
After midsem-slides-1224252673846877-9 nirav
 
Qtp tutorial
Qtp tutorialQtp tutorial
Qtp tutorial
 
Qtp not just for gui anymore
Qtp   not just for gui anymoreQtp   not just for gui anymore
Qtp not just for gui anymore
 
I.m.p
I.m.pI.m.p
I.m.p
 
GL_Web application testing using selenium
GL_Web application testing using seleniumGL_Web application testing using selenium
GL_Web application testing using selenium
 
1
11
1
 

Similar a Java programming basics

Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Introduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleIntroduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleSpringPeople
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to JavaSoumya Suman
 
Java training in bangalore
Java training in bangaloreJava training in bangalore
Java training in bangalorezasi besant
 
java Training in Ranchi
java Training in Ranchijava Training in Ranchi
java Training in Ranchisanjaydeo12
 
XebiaLabs Overview Slides
XebiaLabs Overview SlidesXebiaLabs Overview Slides
XebiaLabs Overview SlidesXebiaLabs
 
MODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptxMODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptxVeerannaKotagi1
 
Gl istqb testing fundamentals
Gl istqb testing fundamentalsGl istqb testing fundamentals
Gl istqb testing fundamentalsPragya Rastogi
 
X pages jumpstart jmp101
X pages jumpstart jmp101X pages jumpstart jmp101
X pages jumpstart jmp101pdhannan
 
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 object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptAliyaJav
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVAKUNAL GADHIA
 

Similar a Java programming basics (20)

Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
L1 basics
L1 basicsL1 basics
L1 basics
 
Introduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeopleIntroduction To Core Java - SpringPeople
Introduction To Core Java - SpringPeople
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Java training in bangalore
Java training in bangaloreJava training in bangalore
Java training in bangalore
 
130700548484460000
130700548484460000130700548484460000
130700548484460000
 
java Training in Ranchi
java Training in Ranchijava Training in Ranchi
java Training in Ranchi
 
Oops
OopsOops
Oops
 
Java (1)
Java (1)Java (1)
Java (1)
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
XebiaLabs Overview Slides
XebiaLabs Overview SlidesXebiaLabs Overview Slides
XebiaLabs Overview Slides
 
MODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptxMODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptx
 
Gl istqb testing fundamentals
Gl istqb testing fundamentalsGl istqb testing fundamentals
Gl istqb testing fundamentals
 
X pages jumpstart jmp101
X pages jumpstart jmp101X pages jumpstart jmp101
X pages jumpstart jmp101
 
Java Intro
Java IntroJava Intro
Java Intro
 
Java Basic.pdf
Java Basic.pdfJava Basic.pdf
Java Basic.pdf
 
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)
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).ppt
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 

Más de Pragya Rastogi (12)

Gl android platform
Gl android platformGl android platform
Gl android platform
 
Qtp questions
Qtp questionsQtp questions
Qtp questions
 
Qtp4 bpt
Qtp4 bptQtp4 bpt
Qtp4 bpt
 
Get ro property outputting value
Get ro property outputting valueGet ro property outputting value
Get ro property outputting value
 
Bp ttutorial
Bp ttutorialBp ttutorial
Bp ttutorial
 
Gl scrum testing_models
Gl scrum testing_modelsGl scrum testing_models
Gl scrum testing_models
 
My Sql concepts
My Sql conceptsMy Sql concepts
My Sql concepts
 
70433 Dumps DB
70433 Dumps DB70433 Dumps DB
70433 Dumps DB
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
70 562
70 56270 562
70 562
 
Mobile testingartifacts
Mobile testingartifactsMobile testingartifacts
Mobile testingartifacts
 
Gl qtp day 3 1
Gl qtp day 3   1Gl qtp day 3   1
Gl qtp day 3 1
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Java programming basics

  • 1. Connect. Collaborate. Innovate. Java Programming Basic Concepts Learning Facilitator: Date: © Copyright GlobalLogic 2009 1
  • 2. Connect. Collaborate. Innovate. Gentle Reminder: “Switch Off” your Mobile Phone Or Switch Mobile Phone to “Silent Mode” © Copyright GlobalLogic 2009 2
  • 3. Connect. Collaborate. Innovate. Agenda • What JAVA is for? – Software Portability – Why Portability Matters – Language and Libraries • Basic Concepts – JVM, Classpath – Packages – Data Types – JavaDoc/Comments – Garbage Collection • Example Java Application © Copyright GlobalLogic 2009 3 3
  • 4. Connect. Collaborate. Innovate. What JAVA does for you? • Hardware Systems – Processor + memory + I/O devices (Platform to execute softwares) • Operating Systems – An operating system (OS) is a set of computer programs that manage the hardware and software resources of a computer. – Runs on top of hardware, so tightly attached with the hardware • Application Softwares – Runs on top of operating system, a subclass of computer software which address a particular objective e.g. Word-processors .. – Application made for one OS/hardware system may not run on another. © Copyright GlobalLogic 2009 4 4
  • 5. Connect. Collaborate. Innovate. Why Portability? • Softwares Portability “Applications that are independent of all hardware and operating systems” You can compile a Java program on any system and run the resulting binary executable file on the same or any other system • “Software portability” refers to adapting a software to a new environment, without re-developing it. This reduces the re- development efforts. © Copyright GlobalLogic 2009 5 5
  • 6. Connect. Collaborate. Innovate. Why Portability? • There are different hardware and operating systems • Even for one OS, there are numerous releases • Software portability is all about “Future-proofing” your Software investment “Future proofing” is a process of trying to anticipate future developments, so that appropriate actions can be taken to minimize negative consequences. • With application programs written in Java, you can change/upgrade OS and applications independently © Copyright GlobalLogic 2009 6 6
  • 7. Connect. Collaborate. Innovate. • Example C program void main() { int arr[2]; printf(“%dn”, arr*3+); } • Run this on windows (using turbo c) • Run this on Unix (using gcc) • Compare the results © Copyright GlobalLogic 2009 7 7
  • 8. Connect. Collaborate. Innovate. Language & Libraries • A “programming language” is about – Describing DATA – Describing STATEMENTS that work on DATA – Describing the ways the two can be put together • How expressions are formed • What statements look like • Java is a Object-oriented, strongly typed language. – Strongly typed languages specify one or more restrictions on how operations involving values having different data types can be intermixed. • Library (package) – Frequently reused code – Not an executable program, but contains executable code – Linking with program's address space © Copyright GlobalLogic 2009 8 8
  • 9. Connect. Collaborate. Innovate. JVM • A virtual machine (VM) is an abstract computer architecture • Software on top of a real hardware • Can run the same application on different machines where the VM is available Java program C program v1 C program v2 Compiler C compiler and executor 1 JVM 1 JVM 2 JVM 3 C compiler and executor 2 Platform 1 Platform 2 Platform 3 © Copyright GlobalLogic 2009 9 9
  • 10. Connect. Collaborate. Innovate. • Java source code is compiled to byte-codes whose target architecture is the Java Virtual Machine (JVM) • Just-in-time (JIT) compiler provides compilation of byte-code to machine code © Copyright GlobalLogic 2009 10 10
  • 11. Connect. Collaborate. Innovate. © Copyright GlobalLogic 2009 11 11
  • 12. Connect. Collaborate. Innovate. Exercise • Write a Java program to print “Hello World!!!” on the command prompt (Use notepad) – Compile the program – Run the program © Copyright GlobalLogic 2009 12 12
  • 13. Connect. Collaborate. Innovate. Classpath • The Classpath is an argument (Environment variable) that tells the Java Virtual Machine where to look for user-defined classes and packages in Java programs. • Setting CLASSPATH from command-line SET CLASSPATH=Dir; • Setting CLASSPATH in Windows via Control-panel © Copyright GlobalLogic 2009 13 13
  • 14. Connect. Collaborate. Innovate. Exercise • Revisit the hello world program • Compiling and running the program from any other directory © Copyright GlobalLogic 2009 14 14
  • 15. Connect. Collaborate. Innovate. Java Packages • A Java package is a mechanism for organizing Java classes into namespaces. • A package provides a unique namespace for the types it contains. • Classes in the same package can access each other's protected members. • Packages are usually defined using a hierarchical naming pattern • Example – java.lang.*, com.globallogic.* © Copyright GlobalLogic 2009 15 15
  • 16. Connect. Collaborate. Innovate. Exercise • Move the hello world program in a package com.globallogic.training.java • Now compile and execute the program © Copyright GlobalLogic 2009 16 16
  • 17. Connect. Collaborate. Innovate. Data Types • A data type is a set of values and the operations on those values – For example, the Java "int" type is the set of 32-bit integers together with the operations "+", "*", "%", etc that operate over integers • A data type describes representation, interpretation and structure of values manipulated by algorithms or objects stored in computer memory or other storage device • Java has two groups of data types, primitive data types and object references. – primitive data types store actual data, – Java object references are variables which hold references to objects © Copyright GlobalLogic 2009 17 17
  • 18. Connect. Collaborate. Innovate. Data Types • Arrays int[] anArray; anArray = new int[10]; OR int[] anArray = new int[10]; • String String greeting = "Hello world!"; character array char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.'}; String helloString = new String(helloArray); Basic operations length concat substr • int, float © Copyright GlobalLogic 2009 18 18
  • 19. Connect. Collaborate. Innovate. Basic I/O • I/O streams • An I/O Stream represents an input source or an output destination. A stream can represent many different kinds of sources and destinations, including disk files, devices, other programs, and memory arrays. • Input stream • Output stream • Writing on console System.out.println(“...”); • Reading from console BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in.readLine(); © Copyright GlobalLogic 2009 19 19
  • 20. Connect. Collaborate. Innovate. Exercise • To determine whether a given string is a palindrome. – Input : a String to be read from console – Ouptput: true/false © Copyright GlobalLogic 2009 20 20
  • 21. Connect. Collaborate. Innovate. Garbage Collection • Garbage collection (GC) is a form of automatic memory management. • The garbage collector or collector attempts to reclaim garbage, or memory used by objects that will never be accessed the application • The basic principle of how a garbage collector works is: – Determine what data objects in a program will not be accessed in the future – Reclaim the resources used by those objects • A key feature of Java is its garbage-collected heap, which takes care of freeing dynamically allocated memory that is no longer referenced. © Copyright GlobalLogic 2009 21 21
  • 22. Connect. Collaborate. Innovate. JavaDoc/Comments Java comments are of three types – Line Comment //line comment – Block Comment /* block comment */ – JavaDoc Comment /** * ... */ • Javadoc is a tool for generating API documentation in HTML format from doc comments in source code © Copyright GlobalLogic 2009 22 22
  • 23. Connect. Collaborate. Innovate. Q&A © Copyright GlobalLogic 2009 23
  • 24. Connect. Collaborate. Innovate. “Thank You” for your learning contribution! Please submit feedback to help L&D make continuous improvement…… Dial @ Learning: Noida: 4444, Nagpur:333, Pune:5222, Banglore:111 E mail: learning@globallogic.com © Copyright GlobalLogic 2009 24