• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about class

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when a class extends an other class .Both class i should create them (on netbeans )i should mouse over the package of my exercise after right click on it and it has a menu first it says new i click on it after it has folder (down of it has the Java class ) .So what i should do is to create with this way to class right? it doesnt matter if a class extends an another?(i mean maybe it doesnt want to be with that way )
 
Marshal
Posts: 79239
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forget about NetBeans for the time being. That is only a tool to make things faster, and I suspect for many beginners it does more to confuse them than help. Remember that all classes extend another class implicitly, even if you don't say extends. That class is called Object.
I don't remember offhand how to create a class on NetBeans.

If you want ClassB to extend ClassA, you must be sure that whatever ClassB represents is a special kind of whatever ClassA represents. Example:-The case with Taxi can be awkward, because you need to think about how you calculate the charge for passengers, which you would not do for an ordinary car.
 
ekte spiriopoulos
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Forget about NetBeans for the time being. That is only a tool to make things faster, and I suspect for many beginners it does more to confuse them than help. Remember that all classes extend another class implicitly, even if you don't say extends. That class is called Object.
I don't remember offhand how to create a class on NetBeans.

If you want ClassB to extend ClassA, you must be sure that whatever ClassB represents is a special kind of whatever ClassA represents. Example:-The case with Taxi can be awkward, because you need to think about how you calculate the charge for passengers, which you would not do for an ordinary car.

why public final class Motorcycle extends Vehicle? what is the difference with the others?final is something that not change as i know like g=10 m/s but in this case what does it means?
 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ekte spiriopoulos wrote:why public final class Motorcycle extends Vehicle? what is the difference with the others?final is something that not change as i know like g=10 m/s but in this case what does it means?


  • Motocycle extends Vehicle, because Motocycle is a Vehicle, just like Car is a Vehicle that is why Car extends Vehicle.


  • In this case final means Motorcycle can not be extended by any other class. i.e, it will not allow like below.
  •  
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic