DataInputStream takes a parameter of low lenvel stream, but System.in is an example of high level stream, then why is the above correct ?

Regards Vineet

Axel Janssen

Ranch Hand

Posts: 2166

posted 15 years ago

Hi Vineet, -->1) I think you only create files with FileOutputStream. The constructor throws the exception sun api )(watch constructor details). The finally is called BEFORE execution is handled back to the caller (the return -1). There is nice sample code in: Mughal, Rasmussen Source CodeName of file: DivisionByZero3.java. 2)This is normal string concatenation. The binary operator + is internally overloaded for Strings. You cannot Do operator overloading for yourself in Java. You can even do things like: String str1 = "its now "; int1 = 3; String str2 = " o clock in Germany"; String str3 = str1 + int1 + str2; ---> String3: "its now 3 o clock in Germany" int1 as operand is implictly converted to String.

3) sun.api.documentation about: void vector.addElement(Object o):

Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity. This method is identical in functionality to the[boolean] add(Object) method (which is part of the List interface). Maybee that add(Object) is introduced later in the ListInterface than Vector class was designed (just a guess). 4) Java api-documentation states as only Constructor of DataInputStream: Constructor SummaryDataInputStream(InputStream in) Creates a FilterInputStream and saves its argument, the input stream in, for later use.