File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How this could be possible?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How this could be possible??" Watch "How this could be possible??" New topic
Author

How this could be possible??

Sandeep Sachan
Greenhorn

Joined: Sep 17, 2005
Posts: 9
Hi, friends,
actually





why this particular code is not generating any compile time and runtime error...

please give me some concrite reason.

waiting for your reply....
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
What makes you think it will give Compile time errors? An Abstract class can contain concrete methods. Also You don't need to instantiate an Object in order to invoke the static methods of the class.


Amit Tank
Linked In
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Amit M Tank:
...An Abstract class can contain concrete methods...

And is not required to contain any abstract methods.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Rafael Souza
Greenhorn

Joined: Jul 03, 2007
Posts: 6
All in all, there�s no need to be surprised when this code compiles and runs successfully!

(Hi, I�ve just signed into this forum. Welcome me )
Sandeep Sachan
Greenhorn

Joined: Sep 17, 2005
Posts: 9
Yes, thnks for your attention,
But Still a query i mean, hwy Java allows abstract class which contains main method. because if i havce the following code then it will not allow me to create the instance of the class.
Manfred Klug
Ranch Hand

Joined: Jun 04, 2007
Posts: 377
Originally posted by Sandeep Sachan:
because if i havce the following code then it will not allow me to create the instance of the class.
You don't need an instance to call a static method.
Jeremy Botha
Ranch Hand

Joined: Feb 16, 2005
Posts: 125
because static methods don't require their defining class to be instantiated as an object before you can access and execute the methods.

As stated above, the syntax of the class you posted above is absolutely fine.

J


McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How this could be possible??
 
Similar Threads
Netscape7.1 and window.createPopup()
Why we live?
onload
input type=file
build.xml question