Java Video Tutorial 16

[ad_1]
Code Here:

Best Java Book :

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


Posted

in

by

Tags:

Comments

29 responses to “Java Video Tutorial 16”

  1. David Shukurov Avatar

    Thanks Derek, great videos!

  2. TillingSaturn Avatar

    Thank you so much for your help with the clone method! I tried so many other videos to help and I could not figure it out but thanks to you I got it in less than 30 seconds 🙂

  3. Brian Smith Avatar

    why not just define the object superCar as a vehicle object

  4. weili zhang Avatar

    Thank you for the awesome tutorial!!! Can I ask is there any repository or zip file to download all the code?

  5. Jørgen Johansen Avatar

    Thank you so much for these videos, it's going to help me a lot towards the exam I have in Java, and also further in my computer science studies 😀

  6. element74 Avatar

    I just did a simple check on super.clone() and it seems to me that it has the same exact properties as an instance. super.clone() returns an object datatype that is also an instance of a class. So why would I use super.clone() over something like Object d = new Class() ?

  7. Youssef Samwel Avatar

    Derek, do you have video that covers classes and objects.

  8. Mhommad Hamza Avatar

    hi derek, in the clone method the super is used to refer the cloneable interface so does this mean that the interface is like a parent class since super is used to reference the parent class another thing that i dont understand is that the clone method is called in the clone method itself and only thing written in clone() is super.clone() so how did it create a clone ?

  9. Amit Singh Avatar

    Vehicle superTruck2 = (Vehicle)superTruck.clone();
    in this line of code why we are casting it…?

  10. BCwithPC Avatar

    In the beginning if I put "Object superCar = new Vehicle();" It tells me that the constructer Vehicle is undefined, but puting "new Vehicle(0, 0) fixes the problem. Do you know what this is saying? Another fix I found was changing this line of code in the Vehicles file: public Vehicle(int wheels, double speed). To: public Vehicle(). But I don't know if this will mess with the code?

  11. TheBlue8ird Avatar

    what does super.clone mean? what's that super?

  12. GobblowGalaxyGamer Avatar

    Are these tutorials that we are now doing are at an intermediate level or beginner's level for java?

  13. Suhas C Avatar

    Hello,

    In Vehicle Class, Can anyone please explain, what does "super.clone" in "public Object clone()" method mean or do?. Is it the "super.clone" of "Class class" or "Crashable class"(which I think it is not)? Any detailed or short & clear explanation would help.

  14. Przemysław Latoch Avatar

    At the beginning you create Object superCar = new Vehicle();
    It doesn't work for me. I have to put eg. Vehicle(0, 0) and then it works.
    I am using IntelliJ, maybe that's why? Can somebody tell me? 🙂

  15. Alin D. Avatar

    Why do i receive the error the constructor vehicle is undefined?
    Please help!!

  16. Rochak Gupta Avatar

    What methods and variables will superTruck2 have access to if I do –
    Object superTruck2 = (Vehicle)superTruck.clone()

    Also, why are we typecasting here again, since we can just do –
    public Vehicle clone(){
    Vehicle car;
    try{
    car = (Vehicle)super.clone()
    }
    catch(CloneNotSupportedException e){
    return null;
    }
    return car;
    }

  17. aqua12500 Avatar

    so if you have "Object superCar = new Vehicle();" what is the difference between that and saying instead "Vehicle superCar = new Vehicle();" or "Object superCar = new Object();" ?

  18. Ali Makhyoun Avatar

    +Derek Banas first great tutorial man

    but I have this problem
    returning null will make me check the car object for null value " if(car!= null) " in the LessonSixteen class if the exception was thrown
    what should I do ?

    public Object clone() {
    Vehicle car ;
    try {
    car =(Vehicle) super.clone();

    } catch (CloneNotSupportedException e) {
    e.printStackTrace();
    return null;
    }
    return car;
    }

  19. Atoshem Ghebrehiwet Avatar

    Hi Derek, Thanks for all your useful videos. I am a little confused about creating an instance of the super Class Object and then Type Casting it to the Vehicle Class. Could you please elaborate why you had to do it that way.

  20. CompSciGuyIT Avatar

    When you spoke about the .finalize() method at 2:50, you said it doesn't always work. What did you mean by this? Why wouldn't a method work when you call it?

  21. newmagicfilms Avatar

    After the basics java you recommand us Head First Java 2nd edition?

  22. Hunter Johnson Avatar

    Been using several resources at a time while programming to learn Java and fully understand it, and your videos are by far the best resources I've used. I thank you so much! Hate not having great examples, and college is terrible at teaching it.

  23. Harbinder Singh Avatar

    Hi Derek!

    How can I get the code of video in color format? Is it possible? The view source option gives black and white code, the printer icon when clicked gives a blank page to print. Any suggestions?

    With Regards

  24. Harbinder Singh Avatar

    Hi Derek Banas!

    If possible kindly also provide the english transcript of the things that you say in your video like you have provided the code. Sometimes it is not possible to understand what you say when you speak in a flow. It's just a suggestion.

    With Regards

  25. VMSALOUDI Avatar

    " Vehicle superCar = new Vehicle() " This statement I understand that you are creating a object of class vehicle but I don't understand Object superCar = new Vehicle() ? Can you explain what it does what you say Object superCar ?

  26. nasr gamer Avatar

    what does

    for (String s: args)
    this mean
    what is the use of
    :
    and
    args

  27. TheWombatGuru Avatar

    in the clone() method inside Vehicle.java – could you use Cloneable.clone() instead of super.clone()? Because as I understand it, super means it gets that clone method from the superClass, and I thought cloneable was the super class in this instance

  28. Ye Maniac Avatar

    Derek, can you tell me which of your videos would help me out? I am developing an endless runner like Subway Surfers. I have everything else ready I just need to start writing the code. If you don't have any tutorial on the above, could you please recommend someone who does to me? Thanks in advance

Leave a Reply

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