Abstract class method returning unknown class

Hi
I have created an abstract class having one of the method returning an object of a class which is not present at the compiletime. surprisingly the compiler didn't check the availability of the returning class at compilation time. it gave exception of classnotfound when I tried to rum it.
is there any explanation of it??

Thanks for the replay. I got the reason.
actually evenif I did not compile to class file, but I have kept my java file in the same directory. while compiling the abstract class the compiler automatically compiled the reffered class and generated the required class file.
I got the error when I moved the java file to another dir
the code is like
<code>
abstract class AbstractTest{
     CompleteClass method1(){
          System.out.println("inside method1 of abstract class");
          return new CompleteClass();
     ExtraClass method2(){
               System.out.println("inside method2 of abstract class");
               return new ExtraClass(); // this class was not compiled before
     } // only java file is there in the dir
     abstract void demoMethod();
</code>

Similar Messages

  • Can a method return a class ?

    hi,
    i have a simple question.
    can a method return class value ?
    in the below script i did'nt understand the commented line.
    package com.google.gwt.sample.stockwatcher.client;
    import com.google.gwt.user.client.rpc.RemoteService;
    import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
    @RemoteServiceRelativePath("login")
    public interface LoginService extends RemoteService {
      public LoginInfo login(String requestUri);  //What is this ? is this a sample of what i asked ?
    }

    The answer to your question is yes.
    The idea is that an object calls a function of another object (passing in objects to the function as arguments) in which that object returns an object (note the arguments or returned value of the function may alternately be primitive types). Each object typically encapsulates data and provides a rich set of functions to the calling object so that calling object doesn't have to deal with the raw data directly. Therefore, not only does the calling object get the data it wants, but also a rich set of functions that can manipulate that data.
    Example:
    Book book = new Book();
    int characterCount = book.getChapter(3).getParagraph(4).getSentence(12).getWord(8).getCharacterCount();
    In the above, each object (Book, Chapter,Paragraph,Sentence,Word) has a rich set of functions it provides to its caller.
    Example: the Sentence Object has a collection of word objects (raw data). Functions it provides to Paragraph object are:
    Word getWord(int index), Words getWords(), int getWordCount().
    If you haven't already done so, I suggest reading a book on Java from cover to cover to pick up such Object Oriented concepts.

  • Calling a class method from another class

    how can i call a method / function of one class without extending that class in another class.
    and one thing more i want want o check wether any Swing gui is open or closed.

    how can i call a method / function of one class without extending that class in another class.What?... Umm... You just call it... as in Foo.bar("doe ray me");
    i want want to check if any Swing gui is open or closed.Ummm, what? I don't understand the question. Do you mean find out if a particular java programming is allready running, of do you mean is the JPanel visible, or something else?

  • How to Call  a Class method in another class.

    Hi All,
    I have created two class
    The class JavaAgent create a object of another TestFrame1 class . I am trying to call
    out.setSize(200,100);
    out.setVisible( true );
    above two method.
    I am a doing some thing wrong. I am getting the error " symbol cannot be resolved".
    public class JavaAgent extends AgentBase {
    private TestFrame1 out;
    private Session session;
    private Database db;
    private Frame frame;
         public void NotesMain() {
              try {
                   Session session = getSession();
                   AgentContext agentContext = session.getAgentContext();
    Database db = agentContext.getCurrentDatabase();
    String title = db.getTitle();
    // System.out.println ("Current database is \"" + title + "\"");
                   TestFrame1 out = new TestFrame1( );
    out.setSize(200,100);
    out.setVisible( true );
    Thread.sleep(250);
              } catch(Exception e) {
                   e.printStackTrace();
    import lotus.domino.*;
    import java.awt.*;
    import javax.swing.*;
    class TestFrame1
    private Session session;
    private Database db;
    TestFrame1( )// Constructor
    JFrame frame = new JFrame("Test Frame 1");
    }

    Hi,
    I guess you are not able to invoke setSize and setVisible method. Am i right ??
    First make sure your TestFrame class is compiled.
    The setSize() and SetVisible are defined in Component and inherited by JFrame.
    In order to use these methods you have to make your TestFrame as subclass of JFrame or provide a utility method
    and from there explicitly call these methods by using the associated JFrame reference.
    And in your JavaAgent class why you declared TestFrame1 twice?? it's really hard to predict your intention.
    Anyway i hope this code will helps you bit...
    import javax.swing.JFrame;
    public class JavaAgent{
         JavaAgent()
          * @param args
         public static void main(String[] args) {          
              TestFrame1 test = new TestFrame1("Test Frame1");
              test.setSize(250,250);
              test.setVisible(true);
    class TestFrame1 extends JFrame
         TestFrame1(String title)
              super(title);

  • Calling a method from an abstract class in a seperate class

    I am trying to call the getID() method from the Chat class in the getIDs() method in the Outputter class. I would usually instantiate with a normal class but I know you cant instantiate the method when using abstract classes. I've been going over and over my theory and have just become more confused??
    Package Chatroom
    public abstract class Chat
       private String id;
       public String getID()
          return id;
       protected void setId(String s)
          id = s;
       public abstract void sendMessageToUser(String msg);
    Package Chatroom
    public class Outputter
    public String[] getIDs()
         // This is where I get confused. I know you can't instantiate the object like:
            Chat users=new Chat();
            users.getID();
    I have the two classes in the package and you need to that to be able to use a class' methods in another class.
    Please help me :(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I have just looked over my program and realised my class names are not the most discriptive, so I have renamed them to give you a clearer picture.
    package Chatroom
    public abstract class Chatter
    private String id;
    public String getID()
    return id;
    protected void setId(String s)
    id = s;
    I am trying to slowly build a chatroom on my own. The Chatter class is a class that will be used to represent a single logged in user and the user is given an ID when he logs in through the setId and getID() methods.
    package Chatroom;
    import java.util.Vector;
    public class Broadcaster
    private Vector<Chatter> chatters = new Vector<Chatter>();
    public String[] getIDs()
    // code here
    The Broadcaster class will keep a list of all logged-in users keeps a list of all the chats representing logged-in users, which it stores in a Vector.I am trying to use the getIDs() method to return an array of Strings comprising the IDs of all logged-in users, which is why im trying to use the getID() method from the Chat class.
    I apologise if I come across as clueless, it's just I have been going through books for about 4 hours now and I have just totally lossed all my bearings

  • Method local Inner class

    Why method local class can access only the final varaible of the method?
    I found somewhere that this is because the non-final local variables go out of scope after method completion, but i wonder final local variables also reside on the stack.
    class MyOuter2 {
    private String x = "Outer2";
    void doStuff() {
    String z = "local variable";
    class MyInner {
    public void seeOuter() {
    System.out.println("Outer x is " + x);
    System.out.println("Local variable z is " + z); // Won't Compile!
    } // close inner class method
    } // close inner class definition
    } // close outer class method doStuff()
    }

    pxNet wrote:
    and so you are now saying it accesses the original variable, not a copy of it?No, I'm not saying that at all; see reply #1. The situation is quite the opposite, the inner class accesses a copy of the variable. Direct access to the local variable is most definitely not allowed. But that doesn't have anything to do with parameter-passing semantics.
    I'll try to clarify with another demonstration of the problem. Assume that direct access to non-final local variables was actually allowed, and that the following example would compile (it won't, of course): class Outer {
        Inner method() {
            Object o = "foo";
            return new Inner() {
                public void modifyLocalVariable() {
                    o = "bar";
        interface Inner {
            void modifyLocalVariable();
        public static void main(String[] args) {
            Inner inner = new Outer().method();
            inner.modifyLocalVariable(); // what local variable is this modifying?
                                         // the local variable in method() has gone
                                         // out of scope!
    }Because of the way anonymous inner and local classes are implemented, they get a copy of the local variables (per the JLS). Mind you, there isn't any parameter passing going on at all in this example.
    ~

  • Calling sub class method from superclass constructure

    hi all
    i have seen a program in which a super class constructure class methods of sub class before initialization of fields in subclass ,i want how this is posibble ?
    thanks in advance

    Hear is the code n other thing i have used final variable without initialization n compiler dosen't report error
    abstract class Test
    public Test()
    System.out.println("In DemoClass Constructer");
    this.show();
    public void show()
    System.out.println("In DemoClass Show() method");
    class Sub1 extends Test
    private final float number;
    public Sub1(float n)
    this.number=n;
    System.out.println((new StringBuilder()).append("Number is==").append(number).toString());
    int j;
    public void show()
    System.out.println("In Sub1 Class Show method ");
    public class DemoClass
    public static void main(String s[])
    Sub1 obj1=new Sub1(5);
    Sub1 obj2=new Sub1(6);
    thanks for reply

  • How to pass importing parameter of super class method to subclass method?

    hi all,
    i have defined  a class
    CLASS CUST_REPORT DEFINITION.
      PUBLIC SECTION.
        METHODS:DATA_RETRIVE IMPORTING  CUSTID_LOW  TYPE ZCUSTOMER-ZCUSTID
                                       CUSTID_HIGH TYPE ZCUSTOMER-ZCUSTID.
        DATA:IT_CUST TYPE TABLE OF ZCUSTOMER,
             WA_CUST TYPE ZCUSTOMER.
    ENDCLASS.                    "cust_report DEFINITION
    The method DATA_RETRIVE   in this class  has two importing parameters named CUSTID_LOW   and CUSTID_HIGH.
    then i have defined subclas of this clas.
    LASS CUST_ORD DEFINITION INHERITING FROM CUST_REPORT.
      PUBLIC SECTION.
        DATA:IT_ORD TYPE TABLE OF ZORDER.
        METHODS:DATA_RETRIVE  REDEFINITION,
               DISPLAY.
    ENDCLASS.                    "cust_ord DEFINITION
    Method DATA_RETRIVE   is redefined.
    So how to pass importing parameteres of super class method to sub class method with the same name.
    Thanks and Regards,
    Arpita

    Hi,
    I tried like this.
    METHOD DATA_RETRIVE.
    CALL METHOD SUPER->DATA_RETRIVE
          EXPORTING
            CUSTID_LOW  = I_CUSTLOW
            CUSTID_HIGH = I_CUSTHIGH.
    ENDMETHOD.
    But  parameters I_CUSTLOW and I_CUSTHIGH are not getting values after call to method.
    Thanks and Regards,
    Arpita

  • About CLASS-METHODS?

    Hi Guys,
    In ABAP objects i have seen while declaring methods, they are prefixing CLASS-METHODS?
    Actually what does that mean?
    Regards,
    Ammu

    Declares static events in a class or interface in ABAP Objects.
    You can only use this statement in the declaration part of a class declaration (see CLASS ) or interface definition (see INTERFACE). The CLASS- prefix to the EVENTS statement means that the event evt is declared as a static event. Otherwise, the CLASS-EVENTS statement has the same syntax as the EVENTS statement for instance events.
    Static events belong to the static components of a class. Unlike instance events, that can only be triggered in instance methods, static events can be triggered both in instance methods and in static methods.
    Within a class, the appearance of static events is the same as that of instance events, and they can be addressed in the same way. You can also define handler methods for static events using the SET HANDLER statement if their visibility allows it. In this case, there is no FOR addition, since the required information is already available through the definition of the event handler method, and you do not have to specify a triggering instance.
    Note
    If the class has a static constructor (a method called CLASS_CONSTRUCTOR) that has not yet been executed in the program, it is executed on a static event in the class before the first registration of an event handler method.
    Example
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        METHODS CONSTRUCTOR.
        CLASS-METHODS CREATE_COUNT_RESET.
        CLASS-EVENTS  COUNT_RESET.
      PRIVATE SECTION.
        CLASS-DATA CREATE_COUNT TYPE I.
    ENDCLASS.
    CLASS C2 DEFINITION.
      PUBLIC SECTION.
        METHODS COUNT_HANDLER FOR EVENT COUNT_RESET OF C1.
    ENDCLASS.
    DATA: O1 TYPE REF TO C1,
          O2 LIKE O1,
          O3 LIKE O1,
          HANDL TYPE REF TO C2.
    CREATE OBJECT: O1,
                   O2,
                   O3,
                   HANDL.
    SET HANDLER HANDL->COUNT_HANDLER.
    CLEAR: O1,
           O2,
           O3.
    CALL METHOD C1=>CREATE_COUNT_RESET.
    CLASS C1 IMPLEMENTATION.
      METHOD CONSTRUCTOR.
        CREATE_COUNT = CREATE_COUNT + 1.
      ENDMETHOD.
      METHOD CREATE_COUNT_RESET.
        CLEAR CREATE_COUNT.
        RAISE EVENT COUNT_RESET.
      ENDMETHOD.
    ENDCLASS.
    CLASS C2 IMPLEMENTATION.
      METHOD COUNT_HANDLER.
        WRITE 'Object counter reset'.
      ENDMETHOD.
    ENDCLASS.
    This example builds on the first example in the CLASS-METHODS documentation. It is possible to execute the static method CREATE_COUNT_RESET, even though there are no more instances of class C1. The COUNT_HANDLER method of object HANDL of class C2 is registered as handler for the static event COUNT_RESET, and is triggered.

  • Can i call non -abstract method in abstract class into a derived class?

    Hi all,
    Is it possible in java to call a non-abstract method in a abstact class from a class derived from it or this is not possible in java.
    The following example will explain this Ques. in detail.
    abstract class A
    void amethod()
    System.out.println(" I am in Base Class");
    public class B extends A
    void amethod()
    System.out.println(" I am in Derived Class");
    public static void main (String args[])
    // How i code this part to call a method amathod() which will print "I am in Base Class
    }

    Ok, if you want to call a non-static method from a
    static method, then you have to provide an object. In
    this case it does not matter whether the method is in
    an abstract base class or whatever. You simply cannot
    (in any object oriented language, including C++ and
    JAVA) call a nonstatic method without providing an
    object, on which you will call the method.
    To my solution with reflection: It also only works,
    if you have an object. And: if you use
    getDeclaredMethod, then invoke should not call B's
    method, but A's. if you would use getMethod, then the
    Method object returned would reflect to B's method.
    The process of resolving overloaded methods is
    performed during the getMethod call, not during the
    invoke (at least AFAIK, please tell me, if I'm wrong).You are wrong....
    class A {
        public void dummy() {
             System.out.println("Dymmy in A");
    class B extends A {
         public void dummy() {
              System.out.println("Dymmy in B");
         public static void main(String[] args) throws Exception {
              A tmp = new B();
              Class clazz = A.class;
              Method method = clazz.getDeclaredMethod("dummy", null);
              method.invoke(tmp, null);
    }Prints:
    Dymmy in B
    /Kaj

  • I really need abstract static methods in abstract class

    Hello all.. I have a problem,
    I seem to really need abstract static methods.. but they are not supported.. but I think the JVM should implement them.. i just need them!
    Or can someone else explain me how to do this without abstract static methods:
    abstract class A {
    abstract static Y getY();
    static X getX() {
        // this methods uses getY, for example:
        y=getY();
       return new X(y); // or whatever
    class B extends A {
    static Y getY() { return YofB; }
    class C extends A {
    static Y getY() { return YofC; }
    // code that actually uses the classes above:
    // these are static calls
    B.getX();
    A.getX();I know this wont compile. How should i do it to implement the same?

    Damn i posted this in the wrong thread.. anyways.
    Yes offcourse i understand abstract and static
    But i have a problem where the only solution is to use them both.
    I think it is theoretically possible ot implement a JVM with support for abstract static methods.
    In fact it is a design decision to not support abstract static methods.. thats why i am asking this question.. how could you implemented this otherwise?
    There is an ugly soluition i think: using Aspect Oriented Programming with for example AspectJ.. but that solution is really ugly. So anyone has an OO solution?

  • Abstract class method polymorphically using constructors?

    how can i have a method defined in an abstract superclass call a constructor of the actual class running the method?
    abstract class A {
    public List getMultple() {
    List l = new ArrayList();
    for (short i=0;i<4;i++) {
    l.add(this());//<obviously this breaks
    return l
    or something like that. A won't run this method, but its children will...and they can call their constructors, but what do i put here to do that?
    i've tried a call back. an abstract method getOne() in the superclass forces each child to define that method and in each of those i return the results of a constructor. that works fine.
    the problem is i want to abstract this method out of each of these children classes cause its the exact same in each one, just using a different constructor to get multiple of each in a list. so if i use this callback method, then i am not saving the number of methods in each class, so why bother at all?
    any ideas?

    I still say you are coming at it from the wrong angle. A super class is not the way to go. What you are doing sounds like something very similar to something I did not too long ago.
    My requirement was that I had tab delimited text files filed with data that I had to parse. Each line would be used to instantiate one object, so a particular file could be used to instantiate, for example, a thousand objects of the same class. There were different types of files corresponding to different classes to instantiate instances of.
    Here is the design I ended up using.
    An object of class DataTextFileReader is instantiated to parse the text file and generate objects. It includes code for going line by line, handling bad lines and generating objects and reports. The constructor:
    public DataTextFileReader(File inputFile, LineParser<T> theLineParser)LineParser is an interface with one method:
    public T read(String line);When you call a load() method of the DataTextFileReader, it does its thing with the aid of the LineParser's read method, to which each line is passed, and stores the generated objects in an ArrayList. This can be returned by using another method. There are other methods for getting the reports, etc.
    Obviously, the LineParser chosen needs to have code appropriate for parsing the lines in question, so you have to choose and instantiate the right one.
    I find this design to work well. I arrived at it after spending hours giving myself headaches trying to come up with a design where there was a superclass roughly equivalent to the DataTextFileReader mentioned above, and classes extending this that fulfilled the duty of the LineParsers mentioned above... rather like what you are trying to do now.
    I did not care for the solution at first because it did not give me the "Ah, I am clever!" sensation I was expecting when I finally cracked the problem using inheritance, but I quickly came to think that it was much better OOD anyway.
    The LineParsers mentioned above are essentially embodiments of the Factory pattern, and I would recommend you do something similar in your case. Obviously your "constructors" all have to be different, so you should make a separate class for each of those. Then you can put the code that performs the query and loops to create loads of objects in another class called something like DatabaseDepopulator, using appropriate generics as in my example. Really it is the same problem, now that I look at it.
    This will also result in better separation of concepts, if you ask me. Why should the class constructor know how to parse a database result query, much less perform the query? It has nothing to do with databases (I presume). That is the job of an interpreter object.
    As a final note, remember... 95% of the time you feel like the language won't let you do what you want, it is because you shouldn't anyway.
    Drake

  • Is it possible to call methods from another class from within an abstract c

    Is it possible to call methods from another class from within an abstract class ?

    I found an example in teh JDK 131 JFC that may help you. I t is using swing interface and JTable
    If you can not use Swing, then you may want to do digging or try out with the idea presented here in example 3
    Notice that one should refine the abstract table model and you may want to create a method for something like
    public Object getValuesAtRow(int row) { return data[row;}
    to give the desired row and leave the method for
    getValuesAt alone for getting valued of particaular row and column.
    So Once you got the seelcted row index, idxSelctd, from your table
    you can get the row or set the row in your table model
    public TableExample3() {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    // Take the dummy data from SwingSet.
    final String[] names = {"First Name", "Last Name", "Favorite Color",
    "Favorite Number", "Vegetarian"};
    final Object[][] data = {
         {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
         {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
         {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
         {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
         {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
         {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
         {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
         {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
         {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
         {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
         {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
         {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
         {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
         {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
         {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
         {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
         {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
         {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
         {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
         {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
         {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
    // Create a model of the data.
    TableModel dataModel = new AbstractTableModel() {
    // These methods always need to be implemented.
    public int getColumnCount() { return names.length; }
    public int getRowCount() { return data.length;}
    public Object getValueAt(int row, int col) {return data[row][col];}
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int column) {return names[column];}
    public Class getColumnClass(int col) {return getValueAt(0,col).getClass();}
    public boolean isCellEditable(int row, int col) {return (col==4);}
    public void setValueAt(Object aValue, int row, int column) {
    data[row][column] = aValue;
    };

  • Returning a HashMap K, M from a method of a class typed M

    So, this is what I have. I have a class parameterized for a bean type of a collection it receives, and in a method of the class, I need (would like) to return a HashMap typed as <K, M> as in:
    public class MyClass<M> {
       private Collection<M> beanList;
       public HashMap<K, M> getMap(  /* what do I do here */ );
    }I tried to cheat from looking at the Collections.sort method, knowing it uses the List type in its return type as in:
    public static <T extends Comparable<? super T>> void sort(List<T> list)So, I am trying:
    public HashMap<K, M> getMap(Class<K> keyType)But, it is telling me I need to create class K.
    So... how does the Collections.sort method get away with it and I can't????
    I suppose I could write the method as:
    public HashMap<Object, M> getMap()but became somewhat challenged by my first guess.
    Any ideas... or just go with the HashMap with the untyped key?

    ejp wrote:
    provided K is inferable from the arguments.Or from the assignment context:
    Set<String> empty = Collections.emptySet();
    Otherwise you have to parameterise the class on <K, M>.You may also specifically provide K when you use the method if the context doesn't give the compiler enough information or if you want to override it.
    Example:
    Set<Object> singleton1 = Collections.singleton("Hello"); //error
    Set<Object> singleton2 = Collections.<Object>singleton("Hello"); //fineEdited by: endasil on 14-May-2010 4:13 PM

  • About abstract method read() in class InputStream

    I would like to know if behind the method
    public abstract int read() throws IOException
    in the abstract class InputStream there is some code that
    is called when I have to read a stream. In this case where can I find
    something about this code and, if is written in other languages, why
    is not present the key word native?
    Thanks for yours answers and sorry for my bad english.

    Ciao Matteo.
    Scusa se ti rispondo in ritardo... ma ero in pausa pranzo.
    Chiedimi pure qualcosa di pi? specifico e se posso darti una mano ti rispondo.
    Le classi astratte sono utilizzate per fornire un comportamento standard lasciando per? uno o pi? metodi non implementati... liberi per le necessit? implementative degli utilizzatori.
    Nel caso specifico la classe InputStream ? una classe astratta che lascia non implementato il metodo read(). Tu nel tuo codice non utilizzerai mai questa classe come oggetto, ma nel caso specifico una sua sottoclasse che ha implementato il metodo read().
    Se vai nelle api di InputStream vedrai che ci sono diverse sottoclassi che estendono InputStream. Guarda ad esempio il codice di ByteArrayInputStream: in questa classe il metodo read() non ? nativo ma restituisce un byte appartenente al suo array interno.
    I metodi nativi (ad esempio il metodo read() della classe FileInputStream) non hanno implementazione java ma fanno invece riferimento a delle chiamate dirette al sistema operativo.
    Per quanto riguarda la classe FilterInputStream di cui parlavi: essa nel suo costruttore riceve un InputStream. Questo significa che si deve passare nel costruttore non la classe InputStream (che ? astratta) ma una classe che la estende e che quindi non sia astratta. Il motivo per il quale FilterInputStream faccia riferimento a una classe di tipo InputStream al suo interno, ? che in java gli stream di input e di output possono essere composti l'uno sopra l'altro per formare una "catena" (a tal proposito vedi per maggiori dettagli uno dei tani articoli che si trovano in rete.... ad esempio ti indico questo http://java.sun.com/developer/technicalArticles/Streams/ProgIOStreams/). Comunque per dirla in due parole: tu puoi voler usare un FileInputStream per leggere un file, ma se hai bisogno di effettuare una lettura pi? efficiente (quindi bufferizzata) puoi aggiungere in catena al FileInputStream un oggetto di tipo FilterInputStream (nel caso specifico un BufferedInputStream che non ? altro che una sottoclasse di FilterInputStream).
    Spero di aver chiarito qualche tuo dubbio!
    Ciao
    Diego

Maybe you are looking for

  • How can I transfer files from one pc the the other pc?

    I've purchased another pc recently and want to transfer my items such as my music and film libraries to my new pc. I want to use HomeShare, and have enabled homeshare on the new pc, and verified it with my apple ID. However, I had to delete my other

  • SXGA+ Projector resolution not supported ?

    I have a projection design f30 projector that has a maximum native display of 1400 x 1050 SXGA+ From a PC it will display this resolution no problem however with a macpro or any laptop i've tried the most I can get is 1280 x 720 ? Is their anything I

  • 10.4.6 Intel Weirdness

    Here's an odd one...after applying the 10.4.6 upgrade to my MacBook Pro (2.0), everything was working beautifully until I had occasion to re-install some software using the Mac OS X install discs that came with the computer. Upon insertion, the disc

  • Incorrect Content-Length

    Dear Java Experts, I am writing a program which communicates with a servlet. The OutputStream of the URLConnection is get and I write a String to it. However, when I use the getContentLength Method to check, the length is always 4. In turn, the serve

  • Project Leader (Bangalore​, India)

    Our client, a leading System Integrator based in Bangalore, India, is looking for Project Leaders (two poitions open) Essential Skills: Should have handled a team of 3-4 people involving team building, technical mentoring, work review, Project Planni