Java interview questions part 1

Java interview questions part 1

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Graphics class is available in _________package.

Correct Answer is : java.awt

2. Which of the following statements is true?

Correct Answer is : all constructor are method

3. Container is the __________ for component class.

Correct Answer is : base class

4. uppercase() and lowercase() methods are accessed by using ______ method .

Correct Answer is : class

5. The methods and data of class Character are defined in the ____________ file

Correct Answer is : UnicodeData

6. Autocloseable was introduced in which Java version?

Correct Answer is : java SE 7

7. What is the alternative of using finally to close resource?

Correct Answer is : autocloseable interface to be implemented

8. Which of the below is a child interface of Autocloseable?

Correct Answer is : Closeable

9. It is a good practise to not throw which exception in close() method of autocloseable?

Correct Answer is : InterruptedException

10. What is the output of below snippet?

Correct Answer is : Runs successfully

11. What is the difference between AutoCloseable and Closeable?

Correct Answer is : Closeable throws IOException; AutoCloseable throws Exception

12. What is the use of Flushable interface?

Correct Answer is : Flushes this stream by writing any buffered output to the underlying stream

13. Which version of java added Flushable interface?

Correct Answer is : java SE 5

14. Does close() implicitly flush() the stream.

Correct Answer is : TRUE

15. AutoCloseable and Flushable are part of which package?

Correct Answer is : Autocloseable java.lang; Flushable java.io

16. What are the components of a marker interface?

Correct Answer is : No fields, No methods

17. Which of the following is not a marker interface?

Correct Answer is : Reader

18. What is not the advantage of Reflection?

Correct Answer is : Examine a class’s field at compile time

19. How private method can be called using reflection?

Correct Answer is : getDeclaredMethods

20. How private field can be called using reflection?

Correct Answer is : getDeclaredFields

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon