Java Video Tutorial 3

Java Video Tutorial 3In this tutorial I show you the if statement, relational operators, logical operators, ternary operator and the switch statement.

If you haven’t watched part 1 watch it first here Java Video Tutorial.

As you watch this video, you will be able to follow it easier if you have the commented code in front of you. It follows the video below.

While this tutorial has been slow it will get much more complicated quickly. So, make sure you understand everything I cover in the beginning.

If you like videos like this share it [nttfblike]

Code From the Video

21 thoughts on “Java Video Tutorial 3”

  1. if possible, please add some videos for java frameworks(i.e Struct’s, spring etc.) in this java video tutorial series..
    Thank you

    1. When you use single quotes you can only use one character. That’s just the way the language works. I don’t particularly like it either

    2. In java once and for all a character is delimited by 2 quotes (”) and a string of characters is delimited by 2 double quotes (“”)… I know related to other languages it can be confusing…

  2. I have to just drop a comment to say thanks for these videos. They have taught me more in a month than I have learned from any book with the last year. I really appreciate that you go beyond the basics and cover enough material to help both a beginning programmer and an experienced programmer.

    1. You’re very welcome 🙂 It makes me very happy to hear that I’m helping so many people. Many more videos are in the works. I won’t be done with Java for at least another year

  3. Love the videos … Learning as we speak. I did notice that this will not call unless you use an if statement instead of else if inside the the original if loop

    // Checks if randomNumber equals 25
    031
    else if (randomNumber == 25)
    032
    {
    033
    System.out.println(“The random number is equal to 25”);
    034
    }

    1. I just made this stream of code to talk about what each of the conditionals do. I guess it just comes naturally to talk while writing the code?

  4. Great vid! I have more questions! Is it necessary to have a break; in the default case? Or any of the other cases for that matter? I’d assume it would continue to check the other cases and nothing would happen. Would having the switch do those unnecessary checks be something that would affect the performance of the program overall?

    Are Conditional operators better for a program’s performance? If I was programming I would have been thinking to write

    If (valueOne > valueTwo)
    {
    int biggestValue = valueOne;
    }
    else {

    int biggestValue = valueTwo;

    }

    rather than

    int biggestValue = (valueOne > valueTwo) ? valueOne : valueTwo;

    1. Yes you don’t need the break and you are correct in regards to what would happen without it. The compiler is normally smart enough to handle any performance issues that come up depending on which conditional tools you use.

  5. Great video! I have question, a lot of people said that in order to become master in programming you have to practice coding a lot, and make a program. and I want to practice this, but I dont have any idea what to program, or what to build with the basic java that I have gained from your tutorial. I really want to improve my programming skill. Do you have any suggestion ? thank you!

  6. int randomNumber = (int) (Math.random() * 50);

    Can you explain how does this represent numbers 1-49? I thought it would take a random number and multiply it by 50.

  7. Hi, really nice tutorials, still learning.
    I noticed that on this website code is a little bit weird, comments really don’t work the best, almost all code i green. Is it the website or is it a mistake? But still great work. Keep it up.

  8. So, would I need papers, a calculator, and patience when coding? Java acts like a pet dog to you, and to me it is like deciphering binary 1’s and 0’s. Also, what can I do to practice? Any questions or practice problems somewhere?

    1. It will come with practice. It is best to print out the code and take notes in your own words. Write down questions you have and I’ll answer them. It may help you dramatically to learn UML. I have a UML tutorial. Many years ago after learning UML everything started to make sense. Also in the beginning you’ll copy and paste code and heavily use code completion. You’ll get it 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *