What is the correct answer?


Which are the valid ways to create DataInputStream streams?

A. new DataInputStream(new File("in.dat"));

B. new DataInputStream(new FileInputStream("in.dat"));

C. new DataInputStream("in.dat");

D. new DataInputStream("in.data","r");

Correct Answer :

B. new DataInputStream(new FileInputStream("in.dat"));

Related Questions

Throwing an exception always causes program termination. Which of the following are not keywords? executeUpdate(------------) returns ___________ Which of the following methods belong to the String class? The check box group class is a subclass of the component class. executeUpdate automatically updates data because___________ The programmer must explicitly create the system .in and system .out objects. If a=10 and b= 15, then the statement x =(a>b)?a:b; assigns the value… forName() is a static factory method Declaring a method synchronized guarantees that the deadlock cannot occur. Which are the valid ways to create DataInputStream streams? To delete a file, we can use an instance of class file. Which of the following statements are true? The name of a Java program file must match the name of the class with… The concept of multiple inheritance is implemented in Java by The import statement is always the first no comment statement in a Java… If a=10 and b= 15, then the statement x =(a>b)?a:b; assigns the value… The use of protected keyword to a member in a class will restrict its… A class may be both abstract and final. The setBackground() method is part of the class Which exception is thrown by the read() method of InputStream class? What is wrong in the following class definitions? abstract class… Which javadoc tag is used to denote a comment for methods parameters? In RMI before running the client program we must start RMI Registry. An individual array element that is passed to a method and modified in… Which of the following will produce a value of 10 if x = 9.7? Which of the following methods can be used to remove a component from… If you want to assign a value of 99 to the variable year, then which of… A method declared as static can not access non-static class members. A final class may not have any abstract method.