- Exercise-1: Echoing words in Java
- Exercise 2: Inputting and Echoing integer and string entered by user
- Exercise-3: How to use If Statement in Java Programming
- Exercise-4: How to Use If-ElseStatement in Java Programming
- Exercise-5: Using Multi If and Else Statement in Java Programming
- Exercise-6: Write a program which will represent the entire relational operators in Java Programming.
- Exercise-7: Write a program to demonstrate the logical operators in Java.
- Excercise-8: Write a Program Using Conditional Operator.
- Exercise-9: Java Exercise of IF and SWITCH
- Exercise-10: Java Exercise of While, Do-While and For Loop
- Exercise-11: Java Misc. Excercise(1-10)
- Exercise-11: Java Misc. Exercise(11-19)
- Exercise-11: Java Misc. Exercise(20-25)
Showing posts with label if. Show all posts
Showing posts with label if. Show all posts
Friday, February 8, 2013
Excercise between W1 and W3
Week-3: 3.1: IF statement
If:
The programming you're doing now is sequential programming, meaning the code is
executed from top to bottom. It's very linear, in that each and every line of code will be
read, starting with the first line of code you write and ending at the last line.
But you don't always want your programmes to work like that. Often, you want code to
be executed only if certain conditions are met. For example, you might want one message
to display if a user is below the age of 18 and a different message if he or she is 18 or
older. You want to control the flow of the programme for yourself. You can do this with
conditional logic.
Conditional logic is mainly about the IF word: IF user is less than 18 then display this
message; IF user is 18 or older then display that message. Fortunately, it's very easy to
use conditional logic in Java. Let's start with IF Statements.
The programming you're doing now is sequential programming, meaning the code is
executed from top to bottom. It's very linear, in that each and every line of code will be
read, starting with the first line of code you write and ending at the last line.
But you don't always want your programmes to work like that. Often, you want code to
be executed only if certain conditions are met. For example, you might want one message
to display if a user is below the age of 18 and a different message if he or she is 18 or
older. You want to control the flow of the programme for yourself. You can do this with
conditional logic.
Conditional logic is mainly about the IF word: IF user is less than 18 then display this
message; IF user is 18 or older then display that message. Fortunately, it's very easy to
use conditional logic in Java. Let's start with IF Statements.
Visit for Details
Subscribe to:
Posts (Atom)