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

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
 

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-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
 
PPTX
Object oriented programming
Young Alista
 
PPTX
Object oriented programming
James Wong
 
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-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
 
Object oriented programming
Young Alista
 
Object oriented programming
James Wong
 
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
 
Ad

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)

PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
community health nursing question paper 2.pdf
Prince kumar
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 

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