SlideShare a Scribd company logo
Africa Information
Technology Initiative
Lecture 1:
Introduction to Java
AITI 2009
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Agenda
• What makes Java special?
• Advantages and disadvantages to using
Java.
• Methodology for developing applications.
2
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Compiler
…
a = b + c
…
…
ld $r1, a
ld $r2, b
add $r3, $r1, $r2
st a, $r3
…
Compiler
High-Level
Code
Machine Code
• A program that translates a programming
language into machine code is called a compiler
• Typically, we must have a compiler for each
operating system/machine combination (platform)
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Compiling Computer Programs
• Because different platforms require different machine
code, you must compile programs separately for
each platform, then execute the machine code.
program
compiler
compiler
compiler
Win
Mac
Unix
machine codemachine code
machine code
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
The Java Compiler is Different!
• The Java compiler produces an
intermediate format called bytecode.
• Bytecode is not machine code for any
real computer.
• Bytecode is machine code for a model
computer.
– This model computer is called the Java
Virtual Machine.
Java Program
compiler
Java Bytecode
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Java Interpreter
• A Java Interpreter is required to execute the
bytecode on a real computer.
• A Java Interpreter converts the bytecode into
machine code.
– As the program executes
– Simulate the execution of the Java Virtual Machine on
the real computer
• You can run bytecode on any computer that has
a Java Interpreter (JRE) installed!
– Only have to compile once
– Can distribute the same bytecode to everyone
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
The Java Approach
Java Program
compiler
Java bytecode
Win
Mac
Unix
Interpreter
Interpreter
Interpreter
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Advantages of Using Java
• Once a Java program is compiled you can run the
bytecode on any device with a Java Interpreter.
– Because you do not have to recompile the program for each
machine, Java is device independent.
• Java is safe. The Java language and compiler restrict
certain operations to prevent errors.
– Would you want an application to have total control of your
phone?
• Make calls, send SMS messages?
• Java standardizes many useful structures and
operations such as lists, managing network connections,
and providing graphical user interfaces
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Disadvantages of Using Java
• Running bytecode through an interpreter is not
as fast as running machine code
– But this disadvantage is slowly disappearing
• Using device specific features (e.g., bluetooth) is
difficult sometimes because Java is device-
independent.
• In order to run a Java program on multiple
devices, each must have a Java Interpreter
– Ex: most Nokia phones come with Java Interpreter
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Programming Methodology
1. Specify and analyze the problem
• Remove ambiguity
• Decide on inputs/outputs and algorithms
1. Design the program solution
• Organize problem into smaller pieces
• Identify existing code to reuse!
1. Implementation (programming)
2. Test and verify implementation
3. Maintain and update program
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Writing Good Code
• A program that meets specification is not
necessarily good.
• Will you be able to make changes to it?
– Will you understand it after some time?
• Others might need to look at your code
– Can they understand it?
• Write your program so that is easy to
understand and extend!
– Spend extra time thinking about these issues.
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Example Code: Comments
/* The HelloWorld class prints “Hello,
World!” to the screen */
public class HelloWorld {
public static void main(String[] args) {
// Prints “Hello, World!”
System.out.println("Hello, World!");
// Exit the program
System.exit(0);
}
}
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Comments
• Comments are used to describe what your code
does as an aid for you or others reading your
code. The Java compiler ignores them.
• Comments are made using //, which comments
to the end of the line, or /* */, which
comments everything inside of it (including
multiple lines)
• Two example comments:
– /* The HelloWorld class prints “Hello, World!” to the
screen */
– // Prints “Hello, World!”
http://aiti.mit.eduAfrica Information Technology Initiative © 2009
Comments on Commenting
• You may collaborate on software projects
with people around the world who you’ll
never meet
• Should be able to figure out how code
works by reading comments alone
• Anything that is not self-evident needs a
comment
• 50% of your code might be comments
• Coding is easy, commenting is not

More Related Content

PDF
Introduction to Java Programming Language
jaimefrozr
 
PPTX
Java v/s .NET - Which is Better?
NIIT India
 
PPTX
Features of java unit 1
RubaNagarajan
 
PPTX
Features of java
Hitesh Kumar
 
PPTX
Java ms harsha
Harsha Batra
 
PPT
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
PPTX
Java presentation
surajdmk
 
PPTX
Important features of java
AL- AMIN
 
Introduction to Java Programming Language
jaimefrozr
 
Java v/s .NET - Which is Better?
NIIT India
 
Features of java unit 1
RubaNagarajan
 
Features of java
Hitesh Kumar
 
Java ms harsha
Harsha Batra
 
J2ee strutswithhibernate-140121221332-phpapp01
Jay Palit
 
Java presentation
surajdmk
 
Important features of java
AL- AMIN
 

What's hot (20)

PPTX
Java Lecture 1
Qualys
 
PPT
Java features
myrajendra
 
PPTX
Training on Core java | PPT Presentation | Shravan Sanidhya
Shravan Sanidhya
 
PPTX
Core Java
NA
 
PPTX
Java Programming (M&M)
mafffffe19
 
PPSX
Industrial Training Report on Java Technology.
Ritesh Kumar Bhanu
 
PDF
Java Programming Basics
Rkrishna Mishra
 
PDF
Introduction to Java
Professional Guru
 
PPTX
Java Intro
Nazmul Hasan Rupok
 
PPTX
Features of java 02
University of Potsdam
 
DOCX
Industrial Training report on java
Softvision Info Solutions Private Limited
 
PPTX
Java seminar
devendrakhairwa
 
PPTX
A Comparison of .NET Framework vs. Java Virtual Machine
Abdelrahman Hosny
 
PPTX
C,c++,java,php,.net training institute in delhi, best training institute for ...
MCM COmpetitive Classes
 
PPTX
Programming in Java
Abhilash Nair
 
PDF
130700548484460000
Tanzeel Ahmad
 
PPT
Java Programming : introduction
Kongu Engineering College, Perundurai, Erode
 
PDF
Summer training report on java se6 technology
Shamsher Ahmed
 
PPTX
Structure programming – Java Programming – Theory
OXUS 20
 
Java Lecture 1
Qualys
 
Java features
myrajendra
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Shravan Sanidhya
 
Core Java
NA
 
Java Programming (M&M)
mafffffe19
 
Industrial Training Report on Java Technology.
Ritesh Kumar Bhanu
 
Java Programming Basics
Rkrishna Mishra
 
Introduction to Java
Professional Guru
 
Java Intro
Nazmul Hasan Rupok
 
Features of java 02
University of Potsdam
 
Industrial Training report on java
Softvision Info Solutions Private Limited
 
Java seminar
devendrakhairwa
 
A Comparison of .NET Framework vs. Java Virtual Machine
Abdelrahman Hosny
 
C,c++,java,php,.net training institute in delhi, best training institute for ...
MCM COmpetitive Classes
 
Programming in Java
Abhilash Nair
 
130700548484460000
Tanzeel Ahmad
 
Java Programming : introduction
Kongu Engineering College, Perundurai, Erode
 
Summer training report on java se6 technology
Shamsher Ahmed
 
Structure programming – Java Programming – Theory
OXUS 20
 
Ad

Viewers also liked (20)

PDF
Ozis Pre
ozis_studio
 
ODP
Griffon: Re-imaging Desktop Java Technology
James Williams
 
PDF
Android - 04 - Internship project introduction
Noveo
 
PPT
1 introduction to java technology
rendezvous07
 
PPT
Chapter 1 introduction to java technology
sshhzap
 
PDF
Java 7 - State of the Enterprise
Markus Eisele
 
PDF
Introduction to java technology
Indika Munaweera Kankanamge
 
PDF
Whitep paper on Emerging java and .net technology and critical trends
Rakesh Jha
 
PPTX
1 java programming- introduction
jyoti_lakhani
 
PPT
1 Introduction To Java Technology
dM Technologies
 
PPTX
Introduction to Java Programming
Pokequesthero
 
PDF
Java Technology Trends
Software Park Thailand
 
PPT
Introduction to-programming
BG Java EE Course
 
PPTX
Presentation On Android OS
Akshay Kakkar
 
PPTX
What is Android OS in ppt ?
SoonTips.com
 
PPTX
Android OS Presentation
hession25819
 
PPT
Java basic
Sonam Sharma
 
PPTX
My presentation on Android in my college
Sneha Lata
 
PPT
Core java slides
Abhilash Nair
 
PPT
Android seminar-presentation
connectshilpa
 
Ozis Pre
ozis_studio
 
Griffon: Re-imaging Desktop Java Technology
James Williams
 
Android - 04 - Internship project introduction
Noveo
 
1 introduction to java technology
rendezvous07
 
Chapter 1 introduction to java technology
sshhzap
 
Java 7 - State of the Enterprise
Markus Eisele
 
Introduction to java technology
Indika Munaweera Kankanamge
 
Whitep paper on Emerging java and .net technology and critical trends
Rakesh Jha
 
1 java programming- introduction
jyoti_lakhani
 
1 Introduction To Java Technology
dM Technologies
 
Introduction to Java Programming
Pokequesthero
 
Java Technology Trends
Software Park Thailand
 
Introduction to-programming
BG Java EE Course
 
Presentation On Android OS
Akshay Kakkar
 
What is Android OS in ppt ?
SoonTips.com
 
Android OS Presentation
hession25819
 
Java basic
Sonam Sharma
 
My presentation on Android in my college
Sneha Lata
 
Core java slides
Abhilash Nair
 
Android seminar-presentation
connectshilpa
 
Ad

Similar to An introduction to java programming language forbeginners(java programming tutorials) (20)

DOCX
JAVA First Day
Sher Singh Bardhan
 
PPT
1.INTRODUCTION TO JAVA_2022 MB.ppt .
happycocoman
 
PPTX
JAVA Module 1______________________.pptx
Radhika Venkatesh
 
PPTX
java intro.pptx
MangaiyarkarasiDurai
 
PPTX
Introduction to java
Steve Fort
 
PPTX
Introduction to java
Ali Baba
 
PPT
Chapter 1 java
ahmed abugharsa
 
PPTX
Object oriented programming
Young Alista
 
PPTX
Object oriented programming
James Wong
 
PPTX
Object oriented programming-with_java
Hoang Nguyen
 
PPTX
Object oriented programming
Fraboni Ec
 
PPTX
Object oriented programming-with_java
Tony Nguyen
 
PPTX
Object oriented programming
Luis Goldster
 
PPTX
Object oriented programming-with_java
Harry Potter
 
PPT
Servlets and JavaServer Pages (JSP) from the B.Sc. Computer Science and Infor...
RaguV6
 
PPT
Core Java Slides
Vinit Vyas
 
PPTX
Learn java theory presentation
Mark John Lado, MIT
 
PDF
Java Programming
Anjan Mahanta
 
PPT
JAVA object oriented programming (oop).ppt
AliyaJav
 
PPSX
Java Semimar Slide (Cetpa)
Pratima Parida
 
JAVA First Day
Sher Singh Bardhan
 
1.INTRODUCTION TO JAVA_2022 MB.ppt .
happycocoman
 
JAVA Module 1______________________.pptx
Radhika Venkatesh
 
java intro.pptx
MangaiyarkarasiDurai
 
Introduction to java
Steve Fort
 
Introduction to java
Ali Baba
 
Chapter 1 java
ahmed abugharsa
 
Object oriented programming
Young Alista
 
Object oriented programming
James Wong
 
Object oriented programming-with_java
Hoang Nguyen
 
Object oriented programming
Fraboni Ec
 
Object oriented programming-with_java
Tony Nguyen
 
Object oriented programming
Luis Goldster
 
Object oriented programming-with_java
Harry Potter
 
Servlets and JavaServer Pages (JSP) from the B.Sc. Computer Science and Infor...
RaguV6
 
Core Java Slides
Vinit Vyas
 
Learn java theory presentation
Mark John Lado, MIT
 
Java Programming
Anjan Mahanta
 
JAVA object oriented programming (oop).ppt
AliyaJav
 
Java Semimar Slide (Cetpa)
Pratima Parida
 

More from Daroko blog(www.professionalbloggertricks.com) (20)

DOCX
Small Business ideas you can start in Nigeria 2014(best Business ideas Nigeri...
Daroko blog(www.professionalbloggertricks.com)
 
DOCX
Agriculture business ideas for 2014(Business ideas Kenya,Business ideas Niger...
Daroko blog(www.professionalbloggertricks.com)
 
DOC
An Introduction to Project management(project management tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
java arlow jdbc tutorial(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
The java rogramming swing _tutorial for beinners(java programming language)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
Java programming basics notes for beginners(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
advanced java programming(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
java swing tutorial for beginners(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
fundamentals of Computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
Computer Graphics display technologies(Computer graphics tutorials and tips)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
Computer Graphics display technologies(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
Displays and color system in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
DOC
Data structures graphics library in computer graphics.
Daroko blog(www.professionalbloggertricks.com)
 
PPT
Csc406 lecture7 device independence and normalization in Computer graphics(Co...
Daroko blog(www.professionalbloggertricks.com)
 
PPT
lecture4 raster details in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
lecture3 color representation in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PPT
lecture1 introduction to computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Small Business ideas you can start in Nigeria 2014(best Business ideas Nigeri...
Daroko blog(www.professionalbloggertricks.com)
 
Agriculture business ideas for 2014(Business ideas Kenya,Business ideas Niger...
Daroko blog(www.professionalbloggertricks.com)
 
An Introduction to Project management(project management tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
java arlow jdbc tutorial(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
The java rogramming swing _tutorial for beinners(java programming language)
Daroko blog(www.professionalbloggertricks.com)
 
Java programming basics notes for beginners(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
advanced java programming(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
java swing tutorial for beginners(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
fundamentals of Computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Computer Graphics display technologies(Computer graphics tutorials and tips)
Daroko blog(www.professionalbloggertricks.com)
 
Computer Graphics display technologies(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Displays and color system in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Data structures graphics library in computer graphics.
Daroko blog(www.professionalbloggertricks.com)
 
Csc406 lecture7 device independence and normalization in Computer graphics(Co...
Daroko blog(www.professionalbloggertricks.com)
 
lecture4 raster details in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
lecture3 color representation in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
lecture1 introduction to computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 

Recently uploaded (20)

PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PPTX
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
BANDITA PATRA
 
PDF
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
PDF
Landforms and landscapes data surprise preview
jpinnuck
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
Understanding operators in c language.pptx
auteharshil95
 
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
Sourav Kr Podder
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Mithil Fal Desai
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
UPPER GASTRO INTESTINAL DISORDER.docx
BANDITA PATRA
 
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
Landforms and landscapes data surprise preview
jpinnuck
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Understanding operators in c language.pptx
auteharshil95
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
Open Quiz Monsoon Mind Game Final Set.pptx
Sourav Kr Podder
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Mithil Fal Desai
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 

An introduction to java programming language forbeginners(java programming tutorials)

  • 1. Africa Information Technology Initiative Lecture 1: Introduction to Java AITI 2009
  • 2. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Agenda • What makes Java special? • Advantages and disadvantages to using Java. • Methodology for developing applications. 2
  • 3. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Compiler … a = b + c … … ld $r1, a ld $r2, b add $r3, $r1, $r2 st a, $r3 … Compiler High-Level Code Machine Code • A program that translates a programming language into machine code is called a compiler • Typically, we must have a compiler for each operating system/machine combination (platform)
  • 4. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Compiling Computer Programs • Because different platforms require different machine code, you must compile programs separately for each platform, then execute the machine code. program compiler compiler compiler Win Mac Unix machine codemachine code machine code
  • 5. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 The Java Compiler is Different! • The Java compiler produces an intermediate format called bytecode. • Bytecode is not machine code for any real computer. • Bytecode is machine code for a model computer. – This model computer is called the Java Virtual Machine. Java Program compiler Java Bytecode
  • 6. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Java Interpreter • A Java Interpreter is required to execute the bytecode on a real computer. • A Java Interpreter converts the bytecode into machine code. – As the program executes – Simulate the execution of the Java Virtual Machine on the real computer • You can run bytecode on any computer that has a Java Interpreter (JRE) installed! – Only have to compile once – Can distribute the same bytecode to everyone
  • 7. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 The Java Approach Java Program compiler Java bytecode Win Mac Unix Interpreter Interpreter Interpreter
  • 8. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Advantages of Using Java • Once a Java program is compiled you can run the bytecode on any device with a Java Interpreter. – Because you do not have to recompile the program for each machine, Java is device independent. • Java is safe. The Java language and compiler restrict certain operations to prevent errors. – Would you want an application to have total control of your phone? • Make calls, send SMS messages? • Java standardizes many useful structures and operations such as lists, managing network connections, and providing graphical user interfaces
  • 9. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Disadvantages of Using Java • Running bytecode through an interpreter is not as fast as running machine code – But this disadvantage is slowly disappearing • Using device specific features (e.g., bluetooth) is difficult sometimes because Java is device- independent. • In order to run a Java program on multiple devices, each must have a Java Interpreter – Ex: most Nokia phones come with Java Interpreter
  • 10. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Programming Methodology 1. Specify and analyze the problem • Remove ambiguity • Decide on inputs/outputs and algorithms 1. Design the program solution • Organize problem into smaller pieces • Identify existing code to reuse! 1. Implementation (programming) 2. Test and verify implementation 3. Maintain and update program
  • 11. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Writing Good Code • A program that meets specification is not necessarily good. • Will you be able to make changes to it? – Will you understand it after some time? • Others might need to look at your code – Can they understand it? • Write your program so that is easy to understand and extend! – Spend extra time thinking about these issues.
  • 12. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Example Code: Comments /* The HelloWorld class prints “Hello, World!” to the screen */ public class HelloWorld { public static void main(String[] args) { // Prints “Hello, World!” System.out.println("Hello, World!"); // Exit the program System.exit(0); } }
  • 13. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Comments • Comments are used to describe what your code does as an aid for you or others reading your code. The Java compiler ignores them. • Comments are made using //, which comments to the end of the line, or /* */, which comments everything inside of it (including multiple lines) • Two example comments: – /* The HelloWorld class prints “Hello, World!” to the screen */ – // Prints “Hello, World!”
  • 14. http://aiti.mit.eduAfrica Information Technology Initiative © 2009 Comments on Commenting • You may collaborate on software projects with people around the world who you’ll never meet • Should be able to figure out how code works by reading comments alone • Anything that is not self-evident needs a comment • 50% of your code might be comments • Coding is easy, commenting is not

Editor's Notes

  • #5: two step process!
  • #7: the interpreter is called the JRE
  • #8: much easier to standardize the interpreter, this is a piece of software that Sun releases for different platforms and programmers do not have to worry about the specifics of the machines they are targeting or distributing multiple machine codes. Can have a single compiled program (bytecode) run on anything there is an interpreter for. For example, a website with java code does not have to worry about the specific machine that is being used by the viewer. It is up to the user to get the interpreter.
  • #11: very important to think about the problem and solution and create a design document… program is not static! it is always evolving. must make the code as understandable as possible, to yourselves and to others… very important that code is well designed