Exforsys

Free Training

Abstract classes

This is a discussion on Abstract classes within the Java forums, part of the Programming Talk category; Can we call a concrete method of an abstract class, without inheriting the abstract class? If yes, then how?...

Go Back   Exforsys > Programming Talk > Java

Exforsys.com

  #1 (permalink)  
Old 05-26-2007, 03:08 PM
Junior Member
 
Join Date: May 2007
Posts: 1
maksy is on a distinguished road
Abstract classes

Can we call a concrete method of an abstract class, without inheriting the abstract class? If yes, then how?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-29-2007, 06:31 AM
modiyam's Avatar
Junior Member
 
Join Date: May 2007
Posts: 1
modiyam is on a distinguished road
Send a message via Yahoo to modiyam
Hi,

As per my knlowledge, we can't instantiate abstract classes directly, we must inherit the abstract classes. i mean we can't access a concrete method of an abstract class without inheriting the abstract class
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-04-2007, 01:19 PM
rameshrise's Avatar
Junior Member
 
Join Date: May 2007
Posts: 2
rameshrise is on a distinguished road
In order to access methods of an abstract class we need to extend the class first

Thanks
Rammy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-29-2007, 12:32 PM
Junior Member
 
Join Date: Nov 2007
Posts: 1
josephraja1982 is on a distinguished road
By declaring the methods as static., you can access the methods by using the class name without reference.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-13-2007, 06:18 AM
amitky's Avatar
J2EE Prof.
 
Join Date: Dec 2007
Location: Bangalore
Posts: 7
amitky is on a distinguished road
Send a message via MSN to amitky Send a message via Yahoo to amitky
Joseph you are correct, by declaring the method as static we can access a concrete method of abstract class.
__________________
Amit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-07-2008, 03:40 AM
Junior Member
 
Join Date: Mar 2008
Location: bangalore
Posts: 9
sampra is on a distinguished road
No we cant call without intilizing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-30-2008, 01:56 PM
Junior Member
 
Join Date: Sep 2008
Posts: 3
ssprastogi is on a distinguished road
Thumbs up Yes but only static method in abstract class

You can define static method in abstract class that method do not need any object for this class while calling.

abstract class MyOne
{
public static void show()
{
System.out.println("Abstract show");
}

}
public class ShowMain
{
public static void main(String[] args)
{
MyOne.show();
}

}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-26-2009, 03:57 PM
Junior Member
 
Join Date: Jan 2009
Posts: 2
Bijay29 is on a distinguished road
We cannt create an object of an Abstract class..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Struck Abstract with Abstract Class priyaraji C and C++ 2 05-01-2007 09:04 AM
CSS Tutorials : Lesson 13 – Pseudo Classes JobHelper Career Advice 0 04-14-2006 03:31 PM
Robot Competition FAQ for June 2004 R. Steven Rainwater Tech FAQ 0 05-27-2004 08:59 PM
comp.lang.eiffel Frequently Asked Questions (FAQ) Franck Arnaud Tech FAQ 0 04-17-2004 07:27 AM
Factory design pattern Vs abstract factory design pattern Nimmi Srivastav Software Patterns 4 10-26-2003 10:06 AM


All times are GMT -4. The time now is 11:25 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.