SlideShare a Scribd company logo
1 of 32
Chapter 1: Intro to
Java Programming
AP Computer Science A
Building Java Programs, 3rd Edition
In this chapter:
Binary numbers
The basics of programming
Display console output
Creating your own methods
Binary
Numbers
Decimal Numbers
10 digits (0, 1, 2,
3, 4, 5, 6, 7, 8,
9)
Up by a power of
10 each place
value
Binary Numbers
2 digits (0, 1)
Up by a power
of 2 each
place value
Hexadecimal Numbers
16 digits (0, 1, 2, 3, 4, 5, 6, 7,
8, 9, A, B, C, D, E, F)
Up by a power of 16 each
place value
Decimal → Binary
45
= 32 + 8 + 4 + 2 + 1
32’s 16’s 8’s 4’s 2’s 1’s
1 0 1 1 0 1
= 101101
Binary → Decimal
10110
16 + 4 + 2
= 22
16’s 8’s 4’s 2’s 1’s
1 0 1 1 0
Powers of 2
0: 1
1: 2
2: 4
3: 8
4: 16
5: 32
6: 64
7: 128
8: 256
9: 512
10: 1024
Java
Programming
Basics
The Process of Programming
1. Write
Code 2. Compile
3. Execute4. Debug
The Process of Writing
1. Write
Draft
2. Proofread
3. Share4. Revise
Types of Errors
Syntax
Writing code
incorrectly
Caught by
compiler
Example: clas
HelloWorld
public
Logic (bugs)
Code doesn’t work
as expected
Example: displaying
what you didn’t
want displayed
Runtime
Program is stopped
Example: infinite
loop
Class Method Statement
Identifier Naming Conventions
Class names…
BeginWithACapitalLetter
AndCapitalizeEach
SuccessiveWord
Method names…
beginWithALowercase
letterandCapitalizeEach
successiveWord
Identifier Do’s and Don’ts
Do’s:
Contain:
Letters
Numbers
Underscores ( _ )
Dollar signs ( $ )
Examples:
HelloWorld numberOfSpaces
$$money$$ _________ o_O
CAPS_LOCK iHave$0
Don’ts:
Start with a number
Contain spaces
Contain any characters not
listed to the left
Examples:
2Dimensional 3DPoint
funkySymbols@#$% :) :(
^o^
Console
Output
println vs. print
println: Write on the next line when displaying
things again
print: Continue writing on the same line when
displaying things again
Escape Sequences
System.out.print("hello worldn");
=
System.out.print("hello world");
System.out.println();
Escape
Sequence
Meaning
" "
 
n new line
t tab
Input # of Spaces
Afterward
Result
"Merrittt" 1 "Merritt "
"Mulvaneyt" 0 "Mulvaney"
"Millhollent" 6 "Millhollen "
Comments
//these comments
//take up one line each
/*
This comment
can take up as many
lines as I want.
*/
/*
I'm writing a
comment
/*/ inside
of a comment!
*/
//I'm free to
//"quote whatever
//I want"!
Optional (for now) Knowledge
public: can be used in other programs
static: not involved in a specific object
void: no return value
main: default method
String[] args/String args[]: pass an array of Strings
as an argument
System: predefined class
out: a constant in the System class
println: a method that takes a String as a parameter
Making
Methods
Use method naming
conventions
Nothing in here
(for now)
Procedural Decomposition
Breaking up a large task into smaller
subtasks
For example: breaking up your code into
methods
public static void main(String[] args) {
egg();
}
public static void egg() {
System.out.println(" ______");
System.out.println(" / ");
System.out.println("/ ");
System.out.println(" /");
System.out.println(" ______/");
System.out.println();
teaCup();
}
public static void teaCup() {
System.out.println(" /");
System.out.println(" ______/");
System.out.println("+--------+");
System.out.println();
stopSign();
}
public static void stopSign() {
System.out.println(" ______");
System.out.println(" / ");
System.out.println("/ ");
System.out.println("| STOP |");
System.out.println(" /");
System.out.println(" ______/");
System.out.println();
hat();
}
public static void hat() {
System.out.println(" ______");
System.out.println(" / ");
System.out.println("/ ");
System.out.println("+--------+");
}
public static void toInfinityAndBeyond()
{
toInfinityAndBeyond();
}
Strategy
Keep the main method at the top
Write the next method right above the method
you just wrote

More Related Content

Viewers also liked

Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statementsİbrahim Kürce
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsİbrahim Kürce
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocksİbrahim Kürce
 
1 introduction to java technology
1 introduction to java technology1 introduction to java technology
1 introduction to java technologyrendezvous07
 
Android - 04 - Internship project introduction
Android - 04 - Internship project introductionAndroid - 04 - Internship project introduction
Android - 04 - Internship project introductionNoveo
 
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java TechnologyGriffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java TechnologyJames Williams
 
Java 7 - State of the Enterprise
Java 7 - State of the EnterpriseJava 7 - State of the Enterprise
Java 7 - State of the EnterpriseMarkus Eisele
 
Yaazli International AngularJS 5 Training
Yaazli International AngularJS 5 TrainingYaazli International AngularJS 5 Training
Yaazli International AngularJS 5 TrainingArjun Sridhar U R
 
For Loops and Variables in Java
For Loops and Variables in JavaFor Loops and Variables in Java
For Loops and Variables in JavaPokequesthero
 
Yaazli International Spring Training
Yaazli International Spring Training Yaazli International Spring Training
Yaazli International Spring Training Arjun Sridhar U R
 
Yaazli International Web Project Workshop
Yaazli International Web Project WorkshopYaazli International Web Project Workshop
Yaazli International Web Project WorkshopArjun Sridhar U R
 

Viewers also liked (20)

Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
 
Intro to Java Technology
Intro to Java TechnologyIntro to Java Technology
Intro to Java Technology
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
1 introduction to java technology
1 introduction to java technology1 introduction to java technology
1 introduction to java technology
 
Ozis Pre
Ozis PreOzis Pre
Ozis Pre
 
An introduction to java programming language forbeginners(java programming tu...
An introduction to java programming language forbeginners(java programming tu...An introduction to java programming language forbeginners(java programming tu...
An introduction to java programming language forbeginners(java programming tu...
 
Android - 04 - Internship project introduction
Android - 04 - Internship project introductionAndroid - 04 - Internship project introduction
Android - 04 - Internship project introduction
 
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java TechnologyGriffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
 
Java 7 - State of the Enterprise
Java 7 - State of the EnterpriseJava 7 - State of the Enterprise
Java 7 - State of the Enterprise
 
Exception handling in java
Exception handling in java Exception handling in java
Exception handling in java
 
Core java online training
Core java online trainingCore java online training
Core java online training
 
Yaazli International AngularJS 5 Training
Yaazli International AngularJS 5 TrainingYaazli International AngularJS 5 Training
Yaazli International AngularJS 5 Training
 
For Loops and Variables in Java
For Loops and Variables in JavaFor Loops and Variables in Java
For Loops and Variables in Java
 
Yaazli International Spring Training
Yaazli International Spring Training Yaazli International Spring Training
Yaazli International Spring Training
 
Java quick reference v2
Java quick reference v2Java quick reference v2
Java quick reference v2
 
Yaazli International Web Project Workshop
Yaazli International Web Project WorkshopYaazli International Web Project Workshop
Yaazli International Web Project Workshop
 

Similar to Introduction to Java Programming

Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principlesmoduledesign
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principlesmoduledesign
 
The Next Mainstream Programming Language: A Game Developer’s Perspective
The Next Mainstream Programming Language: A Game Developer’s PerspectiveThe Next Mainstream Programming Language: A Game Developer’s Perspective
The Next Mainstream Programming Language: A Game Developer’s Perspectiveguest4fd7a2
 
Tim Popl
Tim PoplTim Popl
Tim Poplmchaar
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2Abdul Haseeb
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#Bertrand Le Roy
 
Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Abou Bakr Ashraf
 
Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)Open Labs Albania
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...Phil Calçado
 
04 Console input output-
04 Console input output-04 Console input output-
04 Console input output-maznabili
 

Similar to Introduction to Java Programming (20)

Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principles
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principles
 
The Next Mainstream Programming Language: A Game Developer’s Perspective
The Next Mainstream Programming Language: A Game Developer’s PerspectiveThe Next Mainstream Programming Language: A Game Developer’s Perspective
The Next Mainstream Programming Language: A Game Developer’s Perspective
 
Tim Popl
Tim PoplTim Popl
Tim Popl
 
C#.net
C#.netC#.net
C#.net
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2
 
Cc code cards
Cc code cardsCc code cards
Cc code cards
 
Introductionof c
Introductionof cIntroductionof c
Introductionof c
 
A01
A01A01
A01
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#
 
Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Visula C# Programming Lecture 2
Visula C# Programming Lecture 2
 
Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)Milot Shala - C++ (OSCAL2014)
Milot Shala - C++ (OSCAL2014)
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
 
07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt
 
04 Console input output-
04 Console input output-04 Console input output-
04 Console input output-
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Introduction to Java Programming

  • 1. Chapter 1: Intro to Java Programming AP Computer Science A Building Java Programs, 3rd Edition
  • 2. In this chapter: Binary numbers The basics of programming Display console output Creating your own methods
  • 4. Decimal Numbers 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) Up by a power of 10 each place value Binary Numbers 2 digits (0, 1) Up by a power of 2 each place value
  • 5. Hexadecimal Numbers 16 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) Up by a power of 16 each place value
  • 6. Decimal → Binary 45 = 32 + 8 + 4 + 2 + 1 32’s 16’s 8’s 4’s 2’s 1’s 1 0 1 1 0 1 = 101101
  • 7. Binary → Decimal 10110 16 + 4 + 2 = 22 16’s 8’s 4’s 2’s 1’s 1 0 1 1 0
  • 8. Powers of 2 0: 1 1: 2 2: 4 3: 8 4: 16 5: 32 6: 64 7: 128 8: 256 9: 512 10: 1024
  • 10. The Process of Programming 1. Write Code 2. Compile 3. Execute4. Debug
  • 11. The Process of Writing 1. Write Draft 2. Proofread 3. Share4. Revise
  • 12. Types of Errors Syntax Writing code incorrectly Caught by compiler Example: clas HelloWorld public Logic (bugs) Code doesn’t work as expected Example: displaying what you didn’t want displayed Runtime Program is stopped Example: infinite loop
  • 14.
  • 15. Identifier Naming Conventions Class names… BeginWithACapitalLetter AndCapitalizeEach SuccessiveWord Method names… beginWithALowercase letterandCapitalizeEach successiveWord
  • 16. Identifier Do’s and Don’ts Do’s: Contain: Letters Numbers Underscores ( _ ) Dollar signs ( $ ) Examples: HelloWorld numberOfSpaces $$money$$ _________ o_O CAPS_LOCK iHave$0 Don’ts: Start with a number Contain spaces Contain any characters not listed to the left Examples: 2Dimensional 3DPoint funkySymbols@#$% :) :( ^o^
  • 18. println vs. print println: Write on the next line when displaying things again print: Continue writing on the same line when displaying things again
  • 19. Escape Sequences System.out.print("hello worldn"); = System.out.print("hello world"); System.out.println(); Escape Sequence Meaning " " n new line t tab Input # of Spaces Afterward Result "Merrittt" 1 "Merritt " "Mulvaneyt" 0 "Mulvaney" "Millhollent" 6 "Millhollen "
  • 20. Comments //these comments //take up one line each /* This comment can take up as many lines as I want. */ /* I'm writing a comment /*/ inside of a comment! */ //I'm free to //"quote whatever //I want"!
  • 21.
  • 22. Optional (for now) Knowledge public: can be used in other programs static: not involved in a specific object void: no return value main: default method String[] args/String args[]: pass an array of Strings as an argument System: predefined class out: a constant in the System class println: a method that takes a String as a parameter
  • 25. Procedural Decomposition Breaking up a large task into smaller subtasks For example: breaking up your code into methods
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. public static void main(String[] args) { egg(); } public static void egg() { System.out.println(" ______"); System.out.println(" / "); System.out.println("/ "); System.out.println(" /"); System.out.println(" ______/"); System.out.println(); teaCup(); } public static void teaCup() { System.out.println(" /"); System.out.println(" ______/"); System.out.println("+--------+"); System.out.println(); stopSign(); } public static void stopSign() { System.out.println(" ______"); System.out.println(" / "); System.out.println("/ "); System.out.println("| STOP |"); System.out.println(" /"); System.out.println(" ______/"); System.out.println(); hat(); } public static void hat() { System.out.println(" ______"); System.out.println(" / "); System.out.println("/ "); System.out.println("+--------+"); }
  • 31. public static void toInfinityAndBeyond() { toInfinityAndBeyond(); }
  • 32. Strategy Keep the main method at the top Write the next method right above the method you just wrote

Editor's Notes

  1. Syntax for intro program