Join Peggy Fisher for an in-depth discussion in this video Using decisions, part of Java Essential Training for Students.
- Now that we've had a review of Data Types,…let's talk about adding decision-making logic in Java.…When adding decision-making logic in Java,…the programmer often uses Relational Operators…to compare two values,…such as, <, <=,…>, >=, ==,…which, remember, is two = signs, or !=.…Do you remember what the "not" symbol is?…It's the !, Shift + 1.…
In addition, sometimes it is necessary…to join two or more statements.…This can be done using Logical operators:…"and", which is two &,…and "or", which is two |.…Remember that the result of any comparison…is always a Boolean value, either true or false.…Here is another example program…with some decision-making logic added.…Let's take a look.…I start out with a println statement…that asks the user to enter their age.…
We read that value in, on line 14, and age = in.nextIn ( ).…Now, we use the Relational Operator <…to compare the value entered by the user…to determine the age grouping of this person.…If the age < 2, it's gonna print out "Infant",…else if the age < 12, it'll print out "Child".…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
Q: How can I make my debugger function like the author’s?
Learning Java Applications (2012)with Todd Perkins1h 42m Beginner
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.