

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to programming with java for beginners, focusing on the use of conditional statements (if statements) and boolean logic. It covers the limitations of sequential programming, the concept of control structures, and the use of boolean values in making decisions. The document also includes examples of 'if' statements, 'if-else' statements, and 'if-else if' statements, as well as style rules for indentation and spacing.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


ESE^
1
Limitations of sequential programming Cannot choose whether or not to performa command/instruction Cannot perform the same command morethan once Such programs are extremely limited!
ESE^
2
Control Structures ^ Allow a program to base its behavior oncertain conditions ^ Two kinds:^ ^ Conditional (If) Statements^ ^ Loop Structures
ESE^
3
Recap: Boolean
^ The following expression each give a
Boolean^ result:
(25 > 24)^ &&
(12 == 13) //results to
false
(25 > 24)^ ||
//results to
true
ESE^
4
ESE^
5
//Assume^
x^ is^ an^ integer if(x^ >^ 10)
{ x = x * 2;System.out.println(“x
=^ “^ +^ x); }
If the condition is true, then the statement(s) (i.e.instructions) will be executed. Otherwise, it/they won’t.
ESE^
6
If statement (contd..)
x^ is^ an^
integer if(x^ >^ 0)System.out.println(x
+^ “^ is^ positive”);
ESE^
7
“if-else” statement //Assume^
x^ is^ an^ integer if(x^ >^ 0)
{ System.out.println(x
+^ “^ is^ positive”); } else^ { System.out.println(x
+^ “^ is^ negative”); }
if (condition){statement(s)} else^ (condition){statement(s)}