Author name: admin

Which class is used to read data from a file using DataInputStream in Java?

Java MCQ: Which class is used to read data from a file using DataInputStream in Java? a) DataReader b) DataInputStream c) FileInputStream d) BufferedInputStream Answer: b) DataInputStream Explanation: The DataInputStream class in Java is used to read primitive data types from an input stream in a machine-independent way. It is part of the java.io package

Which class is used to read data from a file using DataInputStream in Java? Read More »

Which method is used to read a file using BufferedInputStream in Java?

Java MCQ: Which method is used to read a file using BufferedInputStream in Java? a) read() b) readBytes() c) readLine() d) readData() Answer: a) read() Explanation: The read() method in Java is used to read data from a file using the BufferedInputStream class. BufferedInputStream is part of the java.io package and is used to read

Which method is used to read a file using BufferedInputStream in Java? Read More »

Which of the following is NOT a benefit of using Generics in Java?

Java MCQ: Which of the following is NOT a benefit of using Generics in Java? a) Code reusability b) Runtime type checking c) Type safety d) Elimination of type casting Answer: b) Runtime type checking Explanation: Generics in Java offer several benefits, including code reusability, type safety, and the elimination of explicit type casting. However,

Which of the following is NOT a benefit of using Generics in Java? Read More »

Which class provides system-independent server-side implementation?

Java MCQ: Which class provides system-independent server-side implementation? a) Socket b) ServerSocket c) DatagramSocket d) None of the above Answer: b) ServerSocket Explanation: The ServerSocket class in Java provides a system-independent mechanism for server-side socket communication. It listens for requests on a specified port and establishes a connection with clients. Reference links: https://www.rameshfadatare.com/learn-java-programming/ https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Which class provides system-independent server-side implementation? Read More »

Which of these packages contains the exception StackOverflow in Java?

Java MCQ: Which of these packages contains the exception StackOverflow in Java? a) java.lang b) java.util c) java.io d) java.net Answer: a) java.lang Explanation: The StackOverflowError in Java is part of the java.lang package. It is thrown when a stack overflow occurs because an application recurses too deeply. Reference links: https://www.rameshfadatare.com/learn-java-programming/ https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Which of these packages contains the exception StackOverflow in Java? Read More »

Scroll to Top