SlideShare a Scribd company logo
1 of 7
Programming II
In this course you will learn the basic
java language of Programming II.
Array
Arrays are a way to store a list of items.
Each element of the array holds an individual
item, and you can place items into and remove
items from those slots as you need to.
Sample code of array:
String arr[] = new String[10];
arr[10] = “eggplant”;
Loops
A loop is a way of repeating lines of code
more than once. The block of code contained
within the loop will be executed again and again
until the condition required by the loop is met.
for loops
The for loops repeats the statement or the
block of the statements in many times until the
condition is matched
The syntax of for loop:
for (initialization; test; increment){
statements;
}
while loops
The while loops repeats the statement or
the block of the statements as long as the
condition is true
The syntax of while loop:
while (condition) {
bodyOfLoop;
}
Conditionals
Conditional statements allow a program to
execute a certain piece of code based on a
decision.
If conditionals
The if conditional will enables you to executes the different
bits of code. If conditionals contain the keyword if, followed by
a boolean test, followed by a statement (often a block
statement) to execute if the test is true
Sample code of if conditionals:
if (x < y)
System.out.println(“x is smaller than y”);
An optional else keyword provides the statement to execute if
the test is false:
if (x < y)
System.out.println(“x is smaller than y”);
else System.out.println(“y is bigger.”);

More Related Content

What's hot (8)

String Builder & String Buffer (Java Programming)
String Builder & String Buffer (Java Programming)String Builder & String Buffer (Java Programming)
String Builder & String Buffer (Java Programming)
 
Java String
Java StringJava String
Java String
 
oojs
oojsoojs
oojs
 
FreeRTOS Course - Semaphore/Mutex Management
FreeRTOS Course - Semaphore/Mutex ManagementFreeRTOS Course - Semaphore/Mutex Management
FreeRTOS Course - Semaphore/Mutex Management
 
Introduction of basics loop and array
Introduction of basics loop and arrayIntroduction of basics loop and array
Introduction of basics loop and array
 
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 4)
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 4)Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 4)
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 4)
 
Storm introduction
Storm introductionStorm introduction
Storm introduction
 
String in java
String in javaString in java
String in java
 

Viewers also liked (10)

Simple present perfect
Simple present perfectSimple present perfect
Simple present perfect
 
Internet
InternetInternet
Internet
 
Object oriented-programming
Object oriented-programmingObject oriented-programming
Object oriented-programming
 
5 navtex
5 navtex5 navtex
5 navtex
 
Eipr article
Eipr articleEipr article
Eipr article
 
Fantasy and Reality
Fantasy and RealityFantasy and Reality
Fantasy and Reality
 
Cfri presentation 2014
Cfri presentation 2014Cfri presentation 2014
Cfri presentation 2014
 
Synonyms and Antonyms
Synonyms and AntonymsSynonyms and Antonyms
Synonyms and Antonyms
 
Normativas de una buena
Normativas de una buenaNormativas de una buena
Normativas de una buena
 
Leyes de gestalt
Leyes de gestaltLeyes de gestalt
Leyes de gestalt
 

Similar to Programming ii

Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
robertbenard
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
robertbenard
 
Nested Loops in C unit2.docx
Nested Loops in C unit2.docxNested Loops in C unit2.docx
Nested Loops in C unit2.docx
JavvajiVenkat
 

Similar to Programming ii (20)

6.pptx
6.pptx6.pptx
6.pptx
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Loops in java script
Loops in java scriptLoops in java script
Loops in java script
 
Chapter 2 : Programming with Java Statements
Chapter 2 : Programming with Java StatementsChapter 2 : Programming with Java Statements
Chapter 2 : Programming with Java Statements
 
Power shell basics day 6
Power shell basics day 6Power shell basics day 6
Power shell basics day 6
 
javaloop understanding what is java.pptx
javaloop understanding what is java.pptxjavaloop understanding what is java.pptx
javaloop understanding what is java.pptx
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
JAVA LESSON-02.pptx
JAVA LESSON-02.pptxJAVA LESSON-02.pptx
JAVA LESSON-02.pptx
 
Java 7 new features
Java 7 new featuresJava 7 new features
Java 7 new features
 
JAVA LOOP.pptx
JAVA LOOP.pptxJAVA LOOP.pptx
JAVA LOOP.pptx
 
VB(unit1).pptx
VB(unit1).pptxVB(unit1).pptx
VB(unit1).pptx
 
Nested Loops in C unit2.docx
Nested Loops in C unit2.docxNested Loops in C unit2.docx
Nested Loops in C unit2.docx
 
Java generics final
Java generics finalJava generics final
Java generics final
 
Java interview questions 2
Java interview questions 2Java interview questions 2
Java interview questions 2
 
Java Script Introduction
Java Script IntroductionJava Script Introduction
Java Script Introduction
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Perl slid
Perl slidPerl slid
Perl slid
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdf
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Programming ii

  • 1. Programming II In this course you will learn the basic java language of Programming II.
  • 2. Array Arrays are a way to store a list of items. Each element of the array holds an individual item, and you can place items into and remove items from those slots as you need to. Sample code of array: String arr[] = new String[10]; arr[10] = “eggplant”;
  • 3. Loops A loop is a way of repeating lines of code more than once. The block of code contained within the loop will be executed again and again until the condition required by the loop is met.
  • 4. for loops The for loops repeats the statement or the block of the statements in many times until the condition is matched The syntax of for loop: for (initialization; test; increment){ statements; }
  • 5. while loops The while loops repeats the statement or the block of the statements as long as the condition is true The syntax of while loop: while (condition) { bodyOfLoop; }
  • 6. Conditionals Conditional statements allow a program to execute a certain piece of code based on a decision.
  • 7. If conditionals The if conditional will enables you to executes the different bits of code. If conditionals contain the keyword if, followed by a boolean test, followed by a statement (often a block statement) to execute if the test is true Sample code of if conditionals: if (x < y) System.out.println(“x is smaller than y”); An optional else keyword provides the statement to execute if the test is false: if (x < y) System.out.println(“x is smaller than y”); else System.out.println(“y is bigger.”);