Java Important Interview Questions
1. Java’s which system allows a thread to enter a synchronized method on an object, and then wait there until some other thread explicitly notifies it to come out
Answer: Messaging
2. Packages act as containers for
Answer: Classes, Subordinate packages
3. Threads priorities are not integers that specify the relative priority of one thread to another.
Answer: False
4. When java program starts up, which thread begins running immediately?
Answer: Main thread
5. Java provides built-in support for which programming?
Answer: Multithreaded
6. The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.
Answer: Continue
7. When can a constructor be called without specifying arguments?
Answer: When there are no constructors for the class
8. The mechanism which binds together the code and data and keeps both safe is ________.
Answer: Encapsulation
9. ________ is an instance of a class that implements the runnable interface.
Answer: thread
10. Expression must be of the data types :-
Answer: Byte , Short , Int
11. Java define eight simple types of data byte, short, int, long, char, float, double, boolean.
Answer: True
12. What modifiers may be used with top-level class?
Answer: Public , Abstract , Final
13. Syntax to declare a variable in java is :-
Answer: type identifier [=value][,identifier[=value]…]
14. ________ statement in java is conditional branch statement.
Answer: If
15. Which statement used inside a set of nested loops, will only break out of the innermost loop?
Answer: Break
16. In ________ statement condition is true, then statement 1 is executed.
Answer: If
17. The source for the frist package defines three classes
Answer: Protection , Derived , SamePackage
18. Java compiler stores the .class files in the path specified in CLASSPATH environmental variable.
Answer: False
19. Interface can be extended.
Answer: True
20. ________ is the logical construct upon which the entire java language is built.
Answer: Class
21. Is it necessary to implement all the methods of an interface while implementing the interface
Answer: False
22. Which loops can be nested in java?
Answer: While, Do-while, For
23. Float data type is useful when we need fractional values.
Answer: True
24. What all the run( ) method can do?
Answer: Can call other method, Declare variable
25. Variable in an interface are implicitly final and static.
Answer: True
26. Which of the following operators are used in conjunction with the this and super references?
Answer: The dot operator
27. The ________ keyword halts the execution of the current loop and forces control out of the loop.
Answer: Break
28.What is a data structure that controls the state of a collection of threads as a whole?
Answer: Thread group
29. By Providing the interface keyword, Java allows you to fully utilize the which aspect of polymorphism?
Answer: One interface, Multiple methods
30. For externalizable objects the ________ is solely responsible for the external format of its contents.
Answer: Class
31. Which are the java’s control statements?
Answer: For , If , Switch
32. What are the kinds of variables in Java?
Answer: Instance, local, class variables
33. Java Operators can be divided into these groups :-
Answer: Arithmetic , Bitwise , Relational
34. What is an array?
Answer: It is value collection of same type of data type
35. Modulus operator % can be applied to these data types :-
Answer: floating Point , Integer , Character
36. Start( )executes a call to ________.
Answer: run( )
37. ________ is an instance of the class.
Answer: Object
38. ________method starts a threrad by calling its run method.
Answer: start( )
Post new comment