About abstract interface and it's method

Hi !!
HttpSession session = request.getSession();
getSession() is the Method of HttpSession and it is the abstract interface..
right ??
so how can we call the abstract method and ..
here... request is the object of HttpServletRequest which is abstract interface so how can we make an Object of this abstract interface...
I m very confused Please solve my Querry ASAP

As far as I can tell, these three threads are all the same person asking the same question.
http://forum.java.sun.com/thread.jspa?threadID=5188609
http://forum.java.sun.com/thread.jspa?threadID=5188638
http://forum.java.sun.com/thread.jspa?threadID=5188603
How obnoxious.

Similar Messages

  • Question about abstract classes and instances

    I have just read about abstract classes and have learned that they cannot be instantiated.
    I am doing some exercises and have done a class named "Person" and an abstract class named "Animal".
    I want to create a method in "Person" that makes it possible to set more animals to Person objects.
    So I wrote this method in class Person and compiled it and did not get any errors, but will this work later when I run the main-method?
    public void addAnimal(Animal newAnimal)
         animal.add(newAnimal);
    }Is newAnimal not an instance?

    Roxxor wrote:
    Ok, but why is it necessary with constructors in abstract classes if we don�t use them (because what I have understand, constructors are used to create objects)?Constructors don't create objects. The new operator creates objects. An object's c'tor is invoked after the object has already been created. The c'tors job is to initialize the newly-created object to a valid state. Whenever a child object is created, the parent's c'tor is run before the child's c'tor, so that by the time we're inside the child's c'tor, setting up the child's state, we know that the parent (or rather the "parent part" of the object we're initializing) is in a valid state.
    Constructor rules:
    1) Every class has at least one ctor.
    1.1) If you do not define an explicit constructor for your class, the compiler provides a implicit constructor that takes no args and simply calls super().
    1.2) If you do define one or more explicit constructors, regardless of whether they take args, then the compiler no longer provides the implicit no-arg ctor. In this case, you must explicitly define a public MyClass() {...} if you want one.
    1.3) Constructors are not inherited.
    2) The first statement in the body of any ctor is either a call to a superclass ctor super(...) or a call to another ctor of this class this(...) 2.1) If you do not explicitly put a call to super(...) or this(...) as the first statement in a ctor that you define, then the compiler implicitly inserts a call to super's no-arg ctor super() as the first call. The implicitly called ctor is always super's no-arg ctor, regardless of whether the currently running ctor takes args.
    2.2) There is always exactly one call to either super(...) or this(...) in each constructor, and it is always the first call. You can't put in more than one, and if you put one in, the compiler's implicitly provided one is removed.

  • Difference between abstract interface and normal interface

    Hello Friends,
    What is the Difference between abstract interface and normal interface?....

    What is the Difference between abstract interface and
    normal interface?....The difference is that you didn't follow convention in the first case. All interfaces are implicitly abstract so you don't have to declare them as such.

  • Question about Abstract Classes and Class Inheritance

    The semester is winding down, and the assignments are getting more complicated....
    Prof has given us a project involving both an interface and an abstract class. There's a class Person, then an abstract class Employee that extends Person, and two types of Employees (Hourly and Salaried) that extend Employee. The finished assignment is a type of payroll program that's supposed to be able to store both types of Employees and related info (name, salary, etc). One thing the prof suggested was to store both HourlyEmployees and SalariedEmployees in an array of Employees. But you can't instantiate an array of Employees directly, of course, since it's an abstract class.
    So is it possible to create an array of Persons, cast either HourlyEmployees or SalariedEmployees into Employee objects, and then store the Employee objects in the Person array? And if I do that, can I still use methods particular to the SalariedEmployees and/or HourlyEmployees once they are in the Person array? Or can I store SalariedEmployee and HourlyEmployee directly in an array of Persons, without having to cast them into anything else? (In that case, I'm not sure what the point of having the abstract Employee class is, though). Do they become just generic "Persons" if I do this?
    Thanks for any help!

    But you
    can't instantiate an array of Employees directly, of
    course, since it's an abstract class.Sure you can. You just can't instantiate Employee (the abstact class itself, as opposed to its subclasses) objects.
    Employee[] employees = new Employee[20];
    employees[0] = new HourlyEmployee();That should work.
    So is it possible to create an array of Persons, cast
    either HourlyEmployees or SalariedEmployees into
    Employee objects, and then store the Employee objects
    in the Person array?You could do that as well, but you shouldn't need to cast it.
    Given the type hierarchy you describe, an HourlyEmployee is a Person, so you should be able to assign an HourlyEmployee directly to a Person-valued variable.
    And if I do that, can I still use
    methods particular to the SalariedEmployees and/or
    HourlyEmployees once they are in the Person array?No. If the method doesn't exist in Person, then you can't call it on a Person variable, even if the method does exist in the class implementing Person.
    But if the method exists in Person, but is implemented and possibly overridden in HourlyEmployee, you can still invoke it, by just invoking the Person method.
    public interface Person {
      public void feed();
    public abstract class Employee implements Person {
      public abstract void hire();
    public class HourlyEmployee extends Employee {
    // then:
    Person persons = new Person[20];
    // add HourlyEmployees or SalariedEmployees to persons array...
    persons[0].feed(); // OK!
    persons[0].hire(); // NOT OK!

  • Abstract Interface and BPM

    If I have a Transformation step in my BPM, whether it is necessary to have the Source and Target Message Interface to be ABSTRACT?
    Thanks

    Mohini,
    Absolutley. <b>BPM can interact and deal with only Abstract Interfaces.</b> And so, if you have a transformation step inside the BPM , <b>the source and target interface will have to be abstract interfaces.</b>
    The interface mapping will be between Abs Interfaces in the IR.
    Regards,
    Bhavesh

  • ElementChange interface and accessing those methods..

    Hi all, I'm stuck on accessing the three methods contained in ElementChange (below). This interface class is supposed to be an inner class interface of DocumentEvent, if that helps? This is more a java question about the API (which is not so documented in this area of ElementChange. If someone can lead me down the right path, it would be fantastic!! Thanks so much! Sorry I'm not able to provide my attempts with ElementChange, as I'm so lost at how I can access it.. :(
    Element[] getChildrenAdded();
    Element[] getChildrenRemoved();
    Element[] getElement();So far I have my DocumentListener ( which is added to my JEditorPane - separate class)
    public class Changes implements DocumentListener {
        public Changes() {
        //----------------------Inferface Methods Start-----------------------//
        //Method from DocumentListener
        public void changedUpdate( DocumentEvent e ) {
            pushEditInfo( e );
        //Method from DocumentListener
        public void insertUpdate( DocumentEvent e ) {
            pushEditInfo( e );
        //Method from DocumentListener
        public void removeUpdate( DocumentEvent e ) {
            pushEditInfo( e );
        //----------------------Inferface Methods Finish-----------------------//
        //Method to handle DocumentEvents
        private void pushEditInfo( DocumentEvent e ) {
                Document doc = ( Document )e.getDocument();
                Element elem = doc.getDefaultRootElement();
                //get hold of element change - need this for elementchange class' methods
                e.getChange( elem );
    }

    Mistake: methods are:
    Element[] getChildrenAdded();
    Element[] getChildrenRemoved();
    Element getElement();

  • Abstract class and a static method

    Can i call a static method within an abstract class ?

    public class AbstractDemo {
      public static void main(String[] args) {
        BiPlane biPlane = new BiPlane();
        System.out.println("biplane propulsion = " + biPlane.getPropulsionType());
        JumboJet jumboJet = new JumboJet();
        System.out.println("jet load = " + jumboJet.confirmMaxLoad());
        System.out.println("jet speed = " + jumboJet.getTopSpeed());
        System.out.println(Airplane.confirmMaxLoad());
    abstract class Airplane {
      static String confirmMaxLoad() {
        return "go_get_um, yeehaa!";
      public abstract String getPropulsionType();
      abstract String getTopSpeed();
    class BiPlane extends Airplane {
      public BiPlane() {
        System.out.println("BiPlane constructor");
      static String confirmMaxLoad() {
        return "400 lbs";
      public String getPropulsionType() {
        return "propeller";
      final String getTopSpeed() {
        return "130 knots";
    class JumboJet extends Airplane {
      public JumboJet() {
        System.out.println("JumboJet constructor");
      public String getPropulsionType() {
        return "jet";
      public String getTopSpeed() {
        return "mach .87";
    }

  • Method in abstract interface

    Suppose I have an abstract interface which has one method:
    public abstract interface IParent {
      public void setSignal(int signal);
    }And I have a concrete interface inherited from IParent which also have one method:
    public interface IChild extends IParent {
      public void setSpeed(int speed);
    }If I define a class which implements IChild it only asks me to implement setSpeed method.
    public class Test implements IChild {
    }Why it does not ask me to implement setSignal method of IParent interface?

    Suppose I have an abstract interface which has one method:
    Every interface is implicitly abstract.
    public void setSignal(int signal);
    Every method declaration in the body of an interface is implicitly public.
    And I have a concrete interface inherited from IParent which also have one method:
    Every interface is implicitly abstract.
    If I define a class which implements IChild it only asks me to implement setSpeed method.'It' being what?
    Why it does not ask me to implement setSignal method of IParent interface?I have no idea what 'it' you're talking about, but the Test class will not compile.

  • Need information about interfaces and namespaces in actionscript 3.0

    Hi,
    I need information about actionscript interfaces and
    namespaces, I'm preparing for ACE for Flash CS3 and I need to learn
    about this subjects and I can not find resources or simple examples
    that make these subjects understandable.
    Anybody can help me!
    Thanks a lot.

    Interfaces (cont.)
    Perhaps the most useful feature of interfaces is that you not
    only can define the data type but also method signature of the
    class that implements this interface. In other words, interface can
    define and enforce what methods class MUST implement. This is very
    useful when classes are branching in packages and team of
    developers works on a large application among others.
    The general syntax for an Interface with method signatures is
    written the following way:
    package{
    public interface InterfaceName {
    // here we specify the methods that will heave to be
    implemented
    function method1 (var1:dataType,
    var2:datType,…):returnType;
    function method2 (var1:dataType,
    var2:datType,…):returnType;
    To the previous example:
    package{
    public interface IQualified {
    function method1 ():void;
    function method2 ():int;
    Let’s write a class that implements it.
    If I just write:
    package{
    public class ClassOne extends DisplayObject implements
    IQualified {
    public function ClassOne(){}
    I will get a compilation error that states that I did not
    implement required by the interface methods.
    Now let’s implement only one method:
    package{
    public class ClassOne extends DisplayObject implements
    IQualified {
    private function method1():void{
    return;
    public function ClassOne(){}
    I will get the error again because I implemented only one out
    of two required methods.
    Now let’s implement all of them:
    package{
    public class ClassOne extends DisplayObject implements
    IQualified {
    private function method1():void{
    return;
    private function method2():int{
    return 4;
    public function ClassOne(){}
    Now everything works OK.
    Now let’s screw with return datatypes. I attempt to
    return String instead of void in method1 in ClassOne:
    private function method1():String{
    return “blah”;
    I am getting an error again – Interface requires that
    the method1 returns void.
    Now let’s attempt to pass something into the method1:
    private function method1(obj:MovieClip):void{
    return;
    Oops! An error again. Interface specified that the function
    doesn’t accept any parameters.
    Now rewrite the interface:
    package{
    public interface IQualified {
    function method1 (obj:MovieClip):void;
    function method2 ():int;
    Now compiler stops complaining.
    But, if we revert the class back to:
    private function method1():void{
    return;
    compiler starts complaining again because we don’t pass
    any parameters into the function.
    The point is that interface is sort of a set of rules. In a
    simple language, if it is stated:
    public class ClassOne implements IQualified
    it says: “I, class ClassOne, pledge to abide by all the
    rules that IQualified has established and I will not function
    correctly if I fail to do so in any way. (IMPORTANT) I can do more,
    of course, but NOT LESS.”
    Of course the class that implements an interface can have
    more that number of methods the corresponding interface requires
    – but never less.
    MORE means that in addition to any number of functions it can
    implement as many interfaces as it is desired.
    For instance, I have three interfaces:
    package{
    public interface InterfaceOne {
    function method1 ():void;
    function method2 ():int;
    package{
    public interface InterfaceTwo {
    function method3 ():void;
    package{
    public interface InterfaceThree{
    function method4 ():void;
    If our class promises to implement all three interface it
    must have all four classes in it’s signature:
    package{
    public class ClassOne extends DisplayObject implements
    InterfaceOne, InterfaceTwi, InterfaceThree{
    private function method1():void{return;}
    private function method2():int{return 4;}
    private function method3():void{return;}
    private function method4():void{return;}
    public function ClassOne(){}
    Hope it helps.

  • Any body know about Authority interface?

    Dear all,
    in the GlobalPlatform_Card_API_org.globalplatform_1.5, Authority interface has below information
    public interface Authority
    extends javacard.framework.Shareable
    This interface provides services to recover a cryptographic key and to sign data. The CASD shall publish this interface to the OPEN, using Global Service interface, to make its services available to other Applications. The APSD is the first entity requiring this service from the CASD as shown in 2.1. There is only one CASD inside the card. The CASD shall register this service as a unique Global Service with the service family identifier =’83’ (per section 8.1.3 of GlobalPlatform Card Specification v2.2).
          The Authority interface is responsible for signing and verifying message with a key implicitly known. The implementer of this interface has the knowledge of the keys used for the different operations.
    Since:
        export file version 1.2
    Field Summary
    static byte      MODE_KEY_RECOVERY
              Used in init() methods to indicate key recovery mode.
    static byte      MODE_SIGN
              Used in init() methods to indicate signature sign mode.
    Method Summary
    void      init(byte theMode)
              Initializes the Authority interface with the appropriate mode (MODE_SIGN or MODE_KEY_RECOVERY).
    short      recoverKey(byte[] inBuff, short inOffset, short inLength, byte[] outBuff, short outOffset)
              Recovers a cryptographic key from a set of data structures provided in the input buffer (inBuff).
    short      sign(byte[] inBuff, short inOffset, short inLength, byte[] sigBuff, short sigOffset)
              Generates the signature of all/last input data.
    void      update(byte[] inBuff, short inOffset, short inLength)
              Accumulates input data. for the current operation (MODE_SIGN or MODE_KEY_RECOVERY).
    Method Detail
    init
    void init(byte theMode)
              throws javacard.security.CryptoException
        Initializes the Authority interface with the appropriate mode (MODE_SIGN or MODE_KEY_RECOVERY).
        Parameters:
            theMode - one of MODE_SIGN or MODE_KEY_RECOVERY
        Throws:
          # javacard.security.CryptoException - with the following reason code: ILLEGUAL_VALUE if theMode option is an undefined value
    sign
    short sign(byte[] inBuff,
               short inOffset,
               short inLength,
               byte[] sigBuff,
               short sigOffset)
               throws javacard.security.CryptoException
        Generates the signature of all/last input data. A call to this method resets this Authority interface to the state it was in when previously initialized via a call to init(). That is, the object is reset and available to sign another message. The input and output buffer may overlap and shall be global arrays.
        Parameters:
            inBuff - the input buffer of data to be signed
            inOffset - the offset in input buffer at which the signature starts
            inLength - the byte length to sign
            sigBuff - the output buffer to store signature data
            sigOffset - the offset into sigBuff at which to begin signature generation
        Returns:
            the number of bytes of signature output in sigBuff
        Throws:
          # javacard.security.CryptoException - with the following reason codes: INVALID_INIT if this Authority interface is not initialized or initialized in MODE_KEY_RECOVERY mode.
          # ILLEGAL_USE if this Authority algorithm does not pad the message and the message is not block aligned.
            java.lang.SecurityException - if the inBuff or sigBuff are not global array.
    update
    void update(byte[] inBuff,
                short inOffset,
                short inLength)
                throws javacard.security.CryptoException
        Accumulates input data. for the current operation (MODE_SIGN or MODE_KEY_RECOVERY).
        When this method is used, temporary storage of intermediate results is required. This method should only be used if all the input data required for the current operation is not available in one byte array. The sign or recoverKey methods are recommended whenever possible. The inBuff shall be global array.
        Parameters:
            inBuff - buffer containing input data
            inOffset - offset of input data
            inLength - length of input data
        Throws:
          # javacard.security.CryptoException - with the following reason codes: INVALID_INIT if this Authority interface is not initialized.
            java.lang.SecurityException - if the inBuff is not global array.
    recoverKey
    short recoverKey(byte[] inBuff,
                     short inOffset,
                     short inLength,
                     byte[] outBuff,
                     short outOffset)
                     throws javacard.security.CryptoException
        Recovers a cryptographic key from a set of data structures provided in the input buffer (inBuff). As a mandatory step, the recovery mechanism includes the verification of the origin and integrity of the recovered key. This method knows, from the set of data structures present in the input buffer, which recovery mechanism is to be used. The recovered key is written in the ouput buffer (outBuff) at specified offset (outOffset), in the form of a key data structure whose format depends on the type of the key. A call to this method resets this instance of the Authority interface to the state it was in when previously initialized via a call to init(). That is, the object is reset and available to recover another key. The input and output buffers may overlap and shall be global arrays.
        Parameters:
            inBuff - containing input data.
            inOffset - offset of input data.
            inLength - length of input data.
            outBuff - the buffer where recovered key data structure shall be written
            outOffset - offset where recovered key data structure shall be written
        Returns:
            Length of the recovered key data structure written in outBuff at outOffset,or 0 if the recovery mechanism failed (e.g. recovered key was considered invalid).
        Throws:
          # javacard.security.CryptoException - - with the following reason codes: INVALID_INIT if this Authority interface is not initialized or initialized in MODE_SIGN mode.
            java.lang.SecurityException - if the inBuff or outBuff are not global array.As my knowledge, to use above method of Authority interface, the applet should extends the Authority interface and implement those method above.
    i want to validate above methods, but i still dont understand what should i do to validate above methods. Can any body tell me?
    Thanks

    /* Copyright (c) EJP Retirement Fund, 2007. All rights reserved. */
    public class HeakingException extends Exception
    public interface Heakable
    void heak(Object ... args) throws HeakingException;
    public abstract class AbstractHeakable implements Heakable
    public class HeakableImpl extends AbstractHeakable
      public void    heak(Object ... args) throws HeakingException
          System.out.println("Consider yourself heaked!");
    // and not forgetting the factory pattern
    public abstract class AbstractHeakableFactory
      public static AbstractHeakableFactory getInstance()
        return new HeakableFactoryImpl();
      public abstract Heakable createHeakable();
    class HeakableFactoryImpl extens AbstractHeakableFactory
      public Heakable createHeakable()
         return new HeakableImpl();
    }

  • Transformation Abstract interface

    Hello , i am using a message transformation step in BPM where msg 1 thats input for this map is xml and output is being mapped to a IDOC.
    Now since in BPM i have to use abstract interfaces and how can i relate this abstract interface in transformation step with the IDOC. Can i create the abstract interface and then relate it to IDOC and use it in BPM ?
    Krishna

    Hi Krishna ,
    in message mapping just - drag and drop - the IDOC_type from your node "imported objects"
    Thats all.
    Regards Mario

  • BPM Container for an abstract interface

    Hello all,
    I have created few abstract interfaces. But when I create a BPM container of type abstract interface and click on input help, abstract interfaces are not displayed. What might be the problem ?
    Shankar.

    hi,
    try saving and <b>activating </b>the abstract interfaces
    first
    it might be a problem with the cache
    but try activating the interfaces first
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • BPM with 2 JDBC outbound interfaces and one inbound file interface

    Hi,
    I have a scenario where data is coming from  different databases into XI and after processing the data it creates a file at the target side. Some calculations are to be done in the middleware and the result will be sent through a file.
    My question is
    1. BPM will be used in this scenario?
    2. There will 2 outbound interfaces(one for each database access), 2 abstract interfaces and one inbound interface(file). Please correct me if I am wrong.
    3. I have to multiply the value of field from one database to a particular value in another database and get the final result. For e.g exchange rate from one database is multiplied to Transaction currency in another database and get the group currency value in the output. Can anyone give the sequence of steps in the intergration process for this scenario as I am new to BPM.
    Thanks,
    Aparna

    Thanks a lot Liang and madhusudana for your responses.
    Since I can use JDBC lookup for this in my nornal scenario I think no need for BPM.
    I have created the advanced UDF for JDBC lookup code. Below is the code.
    String Query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    MappingTrace importanttrace;
    importanttrace = container.getTrace();
    // Build the Query String
    Query = "Select home_cur_code FROM  gltrxcp WHERE company_code = '" + a[0] + "' ";
    try{
    //Determine a channel, as created in the Configuration
    channel = LookupService.getChannel("BS_JDBC_send","cc_JDBClookup_rec");
    //Get a system accessor for the channel. As the call is being made to an DB, an DatabaseAccessor is obtained.
    accessor = LookupService.getDataBaseAccessor(channel);
    //Execute Query and get the values in resultset
    resultSet = accessor.execute(Query);
    importanttrace.addWarning("resultset" + resultSet );
    for(Iterator rows = resultSet.getRows();rows.hasNext();){
    Map rowMap = (Map)rows.next();
    result.addValue((String)rowMap.get("HOME_CUR_CODE"));
    importanttrace.addWarning("result" + result );
    catch(Exception ex){
    result.addValue(ex.getMessage());
    finally{
    try{
    if (accessor!=null) accessor.close();
    catch(Exception e){
    result.addValue(e.getMessage());
    But I am not getting the desired result. I am getting result as 'Null'.
    Can you please help in resolving this issue. I have also used trace for find out where it is passing Null and found that 'result' is coming null. Do i also need to parse it before passing it to 'result'?
    Can anyone send sample code for JDBC lookup.

  • Abstract Interfaces....

    Hello,
    I try to understand abstract interfaces (AI), but I couldn't
    answer myself this question. In <a href="/people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm this blog, he used AI for BPM. I know that he have to do this, because BPM can only use AI. The mapping in figure 8 in the blog is also understandable, because incoming files could look different to file structure used in BPM.
    My question: Why he didn't created a mapping for BPM to inbound interface?
    Is it just because he writes the files just as he work in BPM with? If I want to custom the file, saved by inbound interface, I have to do also a mapping, right??
    And if I understood correctly, the flow of which in/outbound interface communicate with an abstract interface is made in sender/receiver determination and agreements. Right??
    Thanks
    Message was edited by: Christian Riekenberg
    Means: inbound, not inboung

    Hi,
    It's very simple: you use Abstract interface ONLY when you want <u>to use a BPM</u>.
    Remind: with  a BPM you can ONLY use Abstract interface and neither Inbound nor Outbound one.
    Thus inside a BPM, an abstract interface could be use either an Inbound or an Outbound interface, but it's always an Abstract interface
    I hope this help you
    Mickael
    Message was edited by: Mickael Huchet

  • Implementing SingleThradModel interface and synchronizing service

    Hi all,
    I came across the one question.
    What is difference between the implementing SingleThradModel interface and synchronizing service method in the Servlet?
    Which one is the better one? and why?
    It seems to be same for me... but still confused?
    Please explain me.
    Thanks,
    Rahul

    No one is better. Just write threadsafe code. E.g. do not declare instance variables which are to be used per request. Just keep in mind that only one instance of the Servlet will be created which lives as long as the webapplication runs and that it will be reused among all requests. Keep request scoped variables inside the method block and you're safe.

Maybe you are looking for

  • How to display data from a recordset based on data from another recordset

    How to display data from a recordset based on data from another recordset. What I would like to do is as follows: I have a fantasy hockey league website. For each team I have a team page (clubhouse) which is generated using PHP/MySQL. The one area I

  • MacPro can no longer see Router

    My Mac Pro suddenly lost sight of one of the two wireless networks I have. Thinking it was a router fault I've rebooted that and everything else in sight, but then I checked my MacBook and found that both networks are still visible. Tried again with

  • How to store data in .csv file

    Hi... I need to export the data in csv format, after retrieving from Database... i am using POI for inserting data from MS Excel to Database... but unable to find any method in POI to store the data in .csv format... need u guys help... plz guide me.

  • Backup of referenced images

    I am new to Aperture. I have my library on my mac and referenced images on an external hard disk. I can backup my library using vault and I can backup my referenced images by copying tmen to another hard disk. If my fiirst hard disk goes down how do

  • Table-like behavior in flash

    I have an app I've built for a client that displays a bunch of dynamic data in a table-like grid. This is currently a "top 10" that shows details of the top-10 winners of a contest. The client has now said that under certain circumstances this "top 1