Java Video Tutorial 16

Java Video Tutorial 16In this part of my Java Video Tutorial, I continue to provide you with a complete understanding of Java.

Today I’m covering the Object and Class class, along with clone. We will explore all of the methods that every object gets by default.

Use the code that follows the video to help you learn. If you missed the previous parts make sure you check them out here Java Video Tutorial.

If you like videos like this share it [nttfblike]

Code From the Video

LESSONSIXTEEN.JAVA

VEHICLE.JAVA

23 thoughts on “Java Video Tutorial 16”

  1. I am taking your tutorial at this moment, and have noticed that the ” Object superCar = new Vehicle(); ” and ” Vehicle superTruck = new Vehicle(); ” line within the L16 code both come up as errors. It would be very helpful to have some feed back on how to fix the error.
    Thank You
    Sincerely Ben T.W

    1. This happened to me too, but it was because in the code for lesson 15 the Vehicle class was missing a constructor. This is added in the code above, so it all works now. Phew!

      Amazing tutorials, thank you Derek!

      1. Oops, disregard this comment! I don’t think I quite understand Java yet… ha. Was it because Line 07 in JavaLesson16 is missing the int and double arg?

      2. thanx eddie. .me too got the same error,and created a costructor in Vehicle class. .it was gone. . Phew!!!!! 😉

    2. The constructor in the VEHICLE class defines two parameters:

      public Vehicle(int wheels, double speed) {
      this.numOfWheels = wheels;
      this.theSpeed = speed;
      }

      Adding a blank constructor can fix this:

      public Vehicle(){
      }

      OR:

      In the JAVALESSONSIXTEEN class these parameters are undefined.

      Object superCar = new Vehicle();

      It should be:

      Object superCar = new Vehicle (4, 10);

      [or whatever int and double values you would choose in place of the 4 and the 10]

  2. hi there, I copied ur code to netbeans and I tried to run it, but no luck. do you think it is becouse I use netbeans insted of Eclipise? thanks for your advice.
    this is the error I get:
    Exception in thread “main” java.lang.VerifyError: (class: lessonsixteen/Vehicle, method: signature: (ID)V) Constructor must call super() or this()
    at lessonsixteen.LessonSixteen.main(LessonSixteen.java:19)

    1. This seems to be a NetBeans error. This is the fix I found online

      Delete .class files from under project/build/classes.

      Click Run -> Clean & Build Project

      I hope that helps

  3. Hello thnaks , do we need to copy the crashable and drivable classes to ur code for this lesson? as they are not included in ur code for this lesson.

    another question I have: does it matter to name the clases with uppercase or lowercase? are Crashable different from CRASHABLE? THNAKS

  4. Hi Derek!

    As many of your students have already stated, and I reiterate, thank you from the bottom of my heart. What you are doing here is giving of your time and from your skill set to help others, and there is no greater gift or deed than to lend a hand to your fellow man. I am grateful for what you do and I feel a bit obligated to learn as much from you as I can, since you’re spending your time teaching us.

    Now that I’ve spit-shined your sitting muscle, I have a few questions that I’d like to ask.

    I love programming and I would enjoy working with a firm developing Java based software. How far off base am I to believe once I finish all 60 of your Java tutorials and I have a firm handle on the language, that I would be able to land a job using this new skill? It would be awesome, but I feel there is a lot more that I don’t know about this and I am hoping you could help me understand what employer would be looking for from me and my skill set so that I could be better prepared and enter the workforce as a competent Java programmer.

    Sincerely,
    William Mosley

    1. Hi William,

      Thank you for the kind message. It is very much appreciated 🙂

      I tried to do something with this Java tutorial that has never been done. I tried to cover everything imaginable. I wanted to make a person willing to go through everything to be an expert on programming java, but also programming in general.

      The java tutorial actually continues after the original 60 to Design Patterns, Java Algorithms, Object Oriented Design, Refactoring, UML, and now Android.

      After Android apps, I’ll cover Android game development. Then I’ll cover the final part being all J2EE related topics. I’ll also probably develop straight Java Games.

      If you go through all of them I’d say you will be a Java expert and an expert in programming in general. I hope that helps 🙂

      Derek

  5. Hello Derek,

    Thank you very much for uploading this tutorial.

    I have one question about the code. In LESSONSIXTEEN.JAVA, line 53, System.out.println(superCar.toString()); why don’t you use superCar.getClasss().toString()?

  6. Hi Derek,

    I’m trying to understand the syntax for the following statement:
    superCar.getClass().getName()

    Is such a statement does it say that there is a function (method) as part of the object (superCar) and inside the getClass() method there is another method defined as getName()?
    Thanks for the explanation.

    jp

Leave a Reply

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