473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

a little bit of confusion on abstract class in java.

dmjpro
2,476 2GB
i knew that the abstract class must have at least one abstract method.

but today accidentally my conception proved as wrong.
that without having any abstract method the class can be abstract.

why it is valid.....is there any logic?????


plz explain me ....
kind regards.
May 10 '07 #1
3 1242
JosAH
11,448 Expert 8TB
i knew that the abstract class must have at least one abstract method.

but today accidentally my conception proved as wrong.
that without having any abstract method the class can be abstract.

why it is valid.....is there any logic?????


plz explain me ....
kind regards.
Abstract classes don't need to have any abstract methods at all. Simply marking
the class as abstract is enough. The class can not be instantiated then, i.e. it
needs to be sub-classed (extended) by a concrete (not abstract) class.
Note that abstract classes can not be marked final too, i.e at most one of those
classifiers is allowed: either concrete (and possibly final) or abstract.

kind regards,

Jos
May 10 '07 #2
r035198x
13,262 8TB
i knew that the abstract class must have at least one abstract method.

but today accidentally my conception proved as wrong.
that without having any abstract method the class can be abstract.

why it is valid.....is there any logic?????


plz explain me ....
kind regards.
You could read the free java classes on this site.
May 10 '07 #3
rsrinivasan
221 100+
Hi,
An abstrack class may or may not have abstract methods. It is depends on the purpose of the class(abstract). if u declaring abstract keyword before the class, it is constdered as abstract class.

Thaks,
Srinivasan r.
May 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Murat Tasan | last post by:
so here is another general question about java... why can't you declare an abstract static method. i can envision the case (indeed i have experienced the case) where one would want an...
10
by: Gianni | last post by:
When I compile my class I get this strange message. The message is strange as that class is not abstract !!!! Please help! Gianni
1
by: G. Smith Q news | last post by:
What is the difference between an abstract class and an Interface. As a novice, they both seem to serve the same purpose?
2
by: Sebastien Degardin | last post by:
Hello, I need to use a Factory pattern to create services class. i have an interface --> MyService i can have an abstract class --> MyAbstractService i have several concrete class for this...
12
by: Daedalus.OS | last post by:
Ok first I'm pretty new to OOP, so my question may sound stupid to some of you. If the only answer you can provide is "get a book about OOP" then don't loose your time and mine cause it's already...
3
by: jhhbr549 | last post by:
Can some help me with this. Please review this code for errors. I can not get it to complie. Here is my Code .. This is an abstract class that is used in conjuntion with 4 other classes.. ...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
19
by: sugard | last post by:
I need to access some data which is in an abstract class. Though you cannot inistialise an abstract class. The task to do is gathering data from a textfile where data is in this format.. P...
5
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am actually a VB.Net guy, but I have worked somewhat with C++ and C#. I just want to ask about the relationship between Abstract Classes and Interfaces. My first question is if...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.