Why classloader doesnot have abstract methods

Hi
I am looking at ClassLoader source code from src.zip under jdk1.5
I see the ClassLoader class definition as abstract but none of the methods are declared as abstract. Why findClass is not an abstract method?
Am I looking at something wrong?
Or
Is this designed purposefully ?
Thanks in advance
-Tumu

Why findClass is not an abstract method?Because it has a default implementation, as defined by ClassLoader.
Am I looking at something wrong?No.
Is this designed purposefully ?Yes. Classes may be declared abstract that have no abstract methods. This is perfectly legal.

Similar Messages

  • Why String  Dont have reverse method

    hi guys am new to java i have small doubt could u pls clear that one.
    In java StringBuffer class have the reverse method but String class dont have a reverse method.
    Why?
    Whats the reason?

    It's not really worth it. You can't have methods for everything or you get language bloat.

  • Why are we using Abstract class?

    Why are we using Abstract class? What is specify use of Abstract class?

    The way I understand it....and I may be wrong because
    I am very new....is that by making the class abstract
    you will add abstract methods to it. Those abstract
    methods MUST be defined in in any subclass that
    inherits from the abstract class thereby making the
    abstract a template for subclasses.
    If your animal class is abstract then you would need
    an abstract method (Which is just siganture, no body)
    of say "numberOfLegs". Then in your dog and cat
    classes which extend animal you must define a
    "numberOfLegs" method with appropriate code.it isn't mandatory for an abstract class to have abstract methods. if a class does have abstract methods, the class must be abstract. but the following is perfectly legal
    public abstract class NoAbstractMethods {
      public void doStuff() {
         // do stuff
    }a subclass of an abstract class can also be abstract, and as such need not implement any additional methods

  • Getting error while creating abstract method

    hi folks,
    i facing issue for ABSTRACT Class.
    I am trying to create abstarct method, (refered example from saptechnical site),
    I created one attribute i-num, created one method AREA, in  implementation area , i made it as Abstract, then i did syntax check, then it is giving below error.
    *Class ZTEST_CLASS01_AB,Method AREA
    The abstract method "AREA" can only be implemented after its
    redefinition (METHODS AREA REDEFINITION).*
    i tried all the ways..
    created subclass for this, i writted some code in AREA of Sub-class, there it is giving dump, because first one is not activated properly..
    could you please somebody help me on this.
    Sri

    Hello Arshad,
    Create a class(ZABSTRACT) and make its type as Abstract( Which means atleast one of its methods is abstract)
    We can have abstract classes with all it's methods as non-abstract or concrete. A small example is given below:
    CLASS gcl_abstract DEFINITION ABSTRACT.
      PUBLIC SECTION.
        METHODS concrete. "Concrete
    ENDCLASS.                    "gcl_abstract DEFINITION
    *       CLASS gcl_abstract IMPLEMENTATION
    CLASS gcl_abstract IMPLEMENTATION.
      METHOD concrete.
        WRITE: / `I'm a concrete method`.
      ENDMETHOD.                    "concrete
    ENDCLASS.                    "gcl_abstract IMPLEMENTATION
    *       CLASS gcl_abstract_sub DEFINITION
    CLASS gcl_abstract_sub DEFINITION INHERITING FROM gcl_abstract.
      PUBLIC SECTION.
        METHODS concrete REDEFINITION.
    ENDCLASS.                    "gcl_abstract_sub DEFINITION
    *       CLASS gcl_abstract_sub IMPLEMENTATION
    CLASS gcl_abstract_sub IMPLEMENTATION.
      METHOD concrete.
        super->concrete( ).
        WRITE: / 'Abstract class might not have abstract methods at all!'.
      ENDMETHOD.                    "concrete
    ENDCLASS.                    "gcl_abstract_sub IMPLEMENTATION
    START-OF-SELECTION.
      DATA: go_abstract TYPE REF TO gcl_abstract_sub.
      CREATE OBJECT go_abstract.
      go_abstract->concrete( ).
    Although i will agree there is no point in making a class as abstract & having no abstract method
    @Sri: Looks like you're trying to implement the abstract method "AREA" in the abstract class hence the error. For abstract method you cannot define their implementation in the corres. abstract class.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 30, 2011 12:04 PM

  • Abstract methods in interface?

    hi, i dun feel that an interface can have abstract methods although the compiler doesn't complain. but i still see developer declares abstract methods in the interface. any clarification on this? thx
    cy

    hi, i dun feel that an interface can have abstract
    methods although the compiler doesn't complain. but i
    still see developer declares abstract methods in the
    interface. any clarification on this? thx
    cyThose developers are just a bit verbose, all methods in an interface are public and abstract.
    Kaj

  • Why java does not force to declare atleast one abstract method

    hi,
    i can define an abstract class without declaring any abstract method in that class. But why wud i do this ? i mean when i have decided that a particular class should be inherited by other subclass and subclass should porvide implementation then there should be atleast one method in the abstract super class which requires implementation.
    All i want to know is why java does not force to declare atleast one abstract method in abstract class.
    there may be some situations where this restriction can create problem if it is like that then can anybody give some example.
    manish

    hi,
    i didn't get u.
    u r trying to say that i have an abstract class with
    only static methods then my questions is why wud
    declare such a class as 'abstract' class? because a
    static method can't be abstract also. Even then if
    somebody want to define such a class with only static
    methods then compiler should force him to declare
    atleast one abstract method which can be implemented
    by subclass, because as i said before if sumbody
    decide to define a class abstract then he wants that
    it should be inhereted but as u r saying a class with
    only static methods then it should not be an abstract
    class it can be a simple class.there's no functional reason, really... actually, factory-like classes are often defined the way Ceci described
    "abstract" only ensures that nobody can ever get an instance of that class (as a matter of fact, what would be the point of getting an instance, if no instance method exists ?)

  • Abstract method which when implemented will have different parameters

    Hello to all,
    I have an assignment but not looking for someone to do it for me. I am only searching for a suggestion on how to do the following.
    Imagine having an application that needs to provide an estimate of the rent for different buildings.
    Basically I start with by having a class name Building. This class has an abstract method called estimateRent.
    I then create two classes that extend the class Building which are named Apartment and House. Both need to have the method estimateRent.
    However the problem is that the rent for the Apartment is calculated on the nights passed in the flat and the people in it, while the rent for the House is just calculated on a month bases.
    This means the estimateRent method requires to have different parameters depending if it is implemented inside the Apartment class or the House class.
    Now I only know of two options.
    The first option is to not declare the estimateRent method as an abstract method inside the Building class and just implemented inside the Apartment and House with different parameters. I do not like this option since in the future if a new Building comes in then I would like to impose the fact that that object needs to have a calculate method.
    The second option is to make the estimateRent method as abstract inside the Building class however takes a parameter of either a String array or else a Map. Then the estimateRent within the Apartment class would search for the elements tagged as nights and people, and the House class would only search for the elements tagged as months!
    However do not know if there are any other, better ways on how to do this. I am using Java 1.4 however if you only have answers for Java 5.0 then please post them again since I always like to learn something new :)
    Thank You for any comments.
    tx

    The implementation changes, yes.Yes that I could understand in the Strategy Pattern (in the document I read it was being compared with the Template Pattern).
    Then you need to refactor your design.I tought about that, however if you read my first post you will notice that I have different criteria on which the costs need to be estimated. While the costs for a flat are estimated on the people staying in and nights slept there, the costs for the house are based only on the months stayed there regardless of the people living in. Now for me I feel that it is bad programming practice to create one method that can have all the parameters required for any scenario. I mean the following is NOT something I am going to do:
    estimateCosts(int nights, int people, int months ... etc);
    That's not a very elegant way of going about it.
    What is the "Context" going to have?Yep I agree, but so far my limited brain has only come up with that! I am open to any other sugestion! always if i understand it first!
    Basically the Context would better be named as Criteria and it would be an interface as follows:
    interface Criteria{}
    Then I would create two classes that implement the Criteria object as follows:
    class AppartmentCriteria implements Criteria{
    public Result estimateCosts(int nights, int people);
    class HouseCriteria implements Criteria{
    public Result estimateCosts(int months);
    Now when I recieve the inputs, depending on the scenario the Criteria is typecasted and the correct parameters passed and we recieve the Result.
    I feel the above sucks since I am not seeing it as an object oriented way of doing this out! Is there any other sugestions! The refactoring thing I am intrested in! however really I can not see how such a call to that method could be refectored!
    Thank You,
    tx.
    PS: Sun has blocked my other account as well, and this time they did not even send me an email to confirm that I was registered successfuully :( Is there someone I can contact on this? I guess next time I will reply with tx53m :)

  • Why am i able to use abstract methods id they aren't yet implemented?

    For example, why i can use this [http://docs.oracle.com/javase/7/docs/api/java/nio/CharBuffer.html#slice] if this is abstract?
    Edited by: 947971 on 13-set-2012 10.38

    947971 wrote:
    Yes, but if CharBuffer has a method declared:
    public abstract CharBuffer slice()So i can't use the method slice() because it's not implemented.
    And why , indeed, i'm able to use it?Because it is implemented by the actual class being used. You can't instantiate abstract classes, so there is a subclass of CharBuffer which does implement the method.
    If you take the interface Comparable, you see that it has an (implicitly)abstract method compareTo. A class that implements Comparable is Integer, so you can easily write:
    Comparable<Integer> i = new Integer(100);
    i.compareTo(new Integer(55));

  • Reg. oops...implementation of abstract method in se24...have ur ponts..

    Hi all,
    In SE24 i made an abstract class & made a method abstract successfully.
    Now i made another class that inherited my abstract class, it is showing my abstract method there.
    Now when i want to give implementation to that method, but when i double click on that system is showing "method is abstract & has not yet redefined".
    Pleas let me know..how i implement it..
    Thanx in advance..
    <b>Have ur point.s</b>

    Hi
    Inheritance Inheritance defines the implementation relationship between classes, in which one class (the subclass) shares the structure and the behavior defined in one or more other classes (superclasses). Note: ABAP Objects only allows single inheritance.
    Inheritance is a relationship, in which one class (the subclass) inherits all the main characteristics of another class (the superclass). The subclass can also add new components (attributes, methods, and so on) and replace inherited methods with its own implementations.
    <b>Single Inheritance</b>
    ABAP Objects only has single inheritance.
    A class may only have one direct superclass, but it can have more than one direct subclass. The empty class OBJECT is the root node of every inheritance tree in ABAP Objects.
    <b>Relationship between Superclasses and Subclasses</b>
    Common components only exists in  the superclass
            new components in the supercalss are automatically available in subclass
            amount of new coding is reduced ( programing by difference)
    Subclass are extremely dependent on superclases
           white box reuse – subclass must possess detailed knowledge of the implementation of the superclass
    <b>Inheritance: Syntax</b>
           Normally the only other entry required for subclasses is what has changed in relation to the direct superclass. Only additions are permitted in ABAP Objects, that  is, in a subclass you can "never take something away from a superclass". All components from the superclass are automatically present in the subclass.
    <b>Class name defination.
        public section.
             methods. First name importing some type some type
                                            returning value(value) type some type.
       private section
              data : make type string..
    Endclass.
    Class name1 definition inheriting name
    public section
           method. : get  returning value ( value) type get.
    Priavte section.
       data : max type some type
    endclass</b>
    <b> Redefining methods</b>
    The REDEFINITION statement for the inherited method must be in the same SECTION as the definition of the original method.
    If you redefine a method, you do not need to enter its interface again in the subclass, but only the name of the method.
    In the case of redefined methods, changing the interface (overloading) is not permitted; exception: Overloading is possible with the constructor.
    Within the redefined method, you can access components of the direct superclass using the SUPER reference.
    The pseudo-reference super can only be used in redefined methods.
    reward if usefull

  • HT201266 why do i have to add a payment method now?

    why do i have to add a payment method now i have had the same apple id n password a while and i dont want anything to change

    Sydney
    You don't give us enough background or info about your current situation = no context. Where are you being asked to add a payment method? EXACTLY. -
    ÇÇÇ

  • Why does not JButton have processActionEvent method, unlike Button ?

    java.awt.Button has processActionEvent( ActionEvent e) method which ( as i think ) calls actionPerformed(e) of the registered listeners.
    Why does not javax.swing.JButton have this method ? from where and how is actionPerformed() of JButton called ?
    I want to know how exactly this event is handled ?
    Thanks in advance.

    eng.robo wrote:
    java.awt.Button has processActionEvent( ActionEvent e) method which ( as i think ) calls actionPerformed(e) of the registered listeners.
    Why does not javax.swing.JButton have this method ? from where and how is actionPerformed() of JButton called ?Swing and AWT are very different and you should not expect one to have the methods of the other.
    I want to know how exactly this event is handled ?Have you read the JButton section in the Sun Swing tutorial? This will tell you much. To see exactly how actions are handled in JButtons, I suggest that you open and look through the source code for the AbstractButton and DefaultButtonModel classes.

  • Why Set does not have get() method

    Can some one tell me why set does not have get method?...

    user12203354 wrote:
    ya u are right that designer of this class thought there is no implementation required for get but why he/she thought like this...
    there must be some valid reason for the same.Because a Set's purpose is not to keep things in order; it's to ensure there are no duplicate entries. Set would require extra code to be able to keep track of an order.
    Note that there is a Set implementation that does keep track of insertion order--LinkedHashSet--but it doesn't have a get() method.

  • Why is it that the interfaces cannot have static methods?

    why is it that the interfaces cannot have static methods?

    Interfaces contain polymorphic methods. Static methods are not polymorphic, and therefore would not make any sense to be in interfaces.

  • I have a bunch of money on my account from iTunes giftcards, so why do I have to select a payment method (credit etc...) when I already have plenty on there?

    So yeah... I have a bunch of money on my account from iTunes giftcards, so why do I have to select a payment method (credit etc...) when I already have plenty on there?
    This has only been a problem with the new update. Help me please!

    Asking for card details is a way of confirming that you are able to buy from that country's store, it doesn't necessarily mean that the card will be charged for the purchase (unless you are trying to gift content or an amount, that can only be done via a credit card) - have you tried entering the card, you should then get the 'none' option so that you can remove it

  • I have an iphone 4s and recently it has not let me update my apps eventhought the apps are free!! I dont know why, it says my payment method is being declined, i have a very low balance but its a free app and a free update so that shouldnt matter shud it?

    I have an iphone 4s and recently it has not let me update my apps eventhought the apps are free!! I dont know why, it says my payment method is being declined, i have a very low balance but its a free app and a free update so that shouldnt matter shud it?

    Yep, it does matter. You won't be able to update or get anything until this is fixed. Contact iTunes support to see what's wrong:
    http://www.apple.com/support/itunes/

Maybe you are looking for

  • I know it is possible as E O Wilson's - Life  On Earth displays it, but how do you place images across multiple pages in iBook Author?

    I have a large image that I would like to span across 2 or possibly more pages in iBook Author. I know that it is possible as you can see it in the above mentioned E O Wilson's Life On Earth. However at the moment when I place an image in the positio

  • How can we change a file from ansi to unicode

    if we receive a plain text file writen by ansi and we need to have it as unicode for a java programe so.. how can we after read it using an inputstream trnsfer it into another file in unicode but carry same text but in unicode and save it using outpu

  • Update css5 error

    When I try to update css5, I get a message saying error downloading this update.  What's up?  Thanks,

  • Java classgen and CDATA

    Hello, I am using the java classgen package to generate xml documents on the fly, and I want to include an ELEMENT, which contains CDATA. So, I have defined the element in the DTD as <!ELEMENT VALUE (#PCDATA)> When using the addData() method from the

  • Photoshop CC error: msvcp110.dll

    Photoshop CC will not run: error message: "msvcp110.dll is missing." Plug-ins and Photoshop CC will not open. Should I reinstall photoshop and plug-ins?