Placeholder Image

Subtitles section Play video

  • >>Teacher:Tell me what is the difference between Class and Object in Java?

  • >>Student:A class is something you take 3 times a week in a semester, like Java Programming

  • Class. It is boring, but we have to take it.

  • >>Teacher:Then what is an Object? Can we NEW an object from a class, like we NEW a dog

  • named Lucky in a Dog class?

  • >>Student:An Object is something you can buy. If you want to create an object, you have

  • to be God to do so.

  • >>Teacher:When you write Java Programs you are the God in this program, you create Lucky

  • from a class called Dog.

  • >>Student:Are you sure? What if I want to create $1000 dollar bill from a class called

  • Money?

  • >>Teacher:Yes you can, but you can only spend the money you created in this Java program.

  • >>Student:That is pretty sad if my Lucky can only live in this program, and my $1000 dollar

  • bill can only be spent here. No exception allowed?

  • >>Teacher:Exceptions? Well, if you Try, you may Catch exceptions, and Finally you may

  • become a successful programmers with lots of real world money and a pet named Lucky!

  • >>Student:Really? But I think it may be easier to Inherit the money from my Dad, and Extend

  • it into mine.

  • >>Teacher:But what if the Cnstructor think you owe them too much money and force you

  • to do Garbage Collection for them?

  • >>Student:No way, I will use my Private Method and my Superclass will take care all these

  • mess. If they don't, I just Crash and Exit with zero value!

>>Teacher:Tell me what is the difference between Class and Object in Java?

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it