Welcome, Guest. Please login or register.
Did you miss your activation email?
Pages: [1]   Go Down
  Print  
Author Topic: Extending a class and use a method from the extended class  (Read 1666 times)
0 Members and 1 Guest are viewing this topic.
deAppel
Favorite member
Member
*

Reputation: 0
HappyFace plants one on you
Offline Offline
Posts: 45
Referrals: 0

Awards
« on: June 18, 2007, 07:11:27 PM »

In this demo we have one class called "ExtendedClassDemo" that calls a method from the class "ExtendedClassDemo"
Example:

Code
GeSHi (java):
  1. /*--------------------------------------------------------------------------
  2. // Author List:
  3. //      deAppel <Creator>
  4. //
  5. // Description:
  6. // Using a method in another class. Part 1/2
  7. //
  8. // Environment:
  9. //      This software was developed using Eclipse and Java 1.6
  10. //
  11. // Copyright Information:
  12. //      Copyright (C) 2007      <Institution><None>
  13. // Ark de Appel www.engineeringserver.com
  14. //
  15. //----------------------------------------------------------------------*/
  16.  
  17. public class ExtendedClass extends ExtendedClassDemo{
  18.  
  19. public static void main(String[] args){
  20. ExtendedClass EC = new ExtendedClass();
  21. EC.classB();
  22. }
  23.  
  24. }
  25.  
Created by GeSHI 1.0.7.20

Code
GeSHi (java):
  1.  
  2. /*--------------------------------------------------------------------------
  3. // Author List:
  4. //      deAppel <Creator>
  5. //
  6. // Description:
  7. // Using a method in another class. Part 2/2
  8. //
  9. // Environment:
  10. //      This software was developed using Eclipse and Java 1.6
  11. //
  12. // Copyright Information:
  13. //      Copyright (C) 2007      <Institution><None>
  14. // Ark de Appel www.engineeringserver.com
  15. //
  16. //----------------------------------------------------------------------*/
  17.  
  18. public class ExtendedClassDemo {
  19.  
  20. public void classB(){
  21. System.out.println("You are calling ExtendedClassDemo");
  22. }
  23.  
  24. }
Created by GeSHI 1.0.7.20
Logged

Earn $0.04 or more for each search you make! http://www.myhpf.co.uk/apply001.asp?Friend=77889

If you need homework help, just post your assignment and i'll code it before your deadline =) i'll provide you "t3h c0d3z" but only if you show me that you have done something and not just ask for me to write everything for you. Just tell us what the problem is and i'm sure we can fix it for you!

I was born into the Hakka lineage, A bloodline that
traces it's roots back to the original Han emperors of
China. During the rise of the 3 Kingdoms (China's
famous warring period), the Hans were overthrown
and exiled. Forced to flee, they headed south finding
refuge within the mountains of Guilin Province where
they lived under their new title, the Hakka and patiently
wait for their chance to return to the throne as the
Sons Of Heaven...
laurens
Member
*

Reputation: 8
Offline Offline
Posts: 121
Referrals: 0

Awards
« Reply #1 on: June 07, 2008, 04:00:58 PM »

Very nice ,

at the begin, When i have started with this it was very anoying and confusing,

While it is pretty easy,
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here