• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

Java Interview Questions Answers

Question - 101 : - What modifiers may be used with an inner class that is a member of an outer class?

Answer - 101 : - A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.

Question - 102 : - What is the Set interface?

Answer - 102 : - The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.

Question - 103 : - Which containers use a FlowLayout as their default layout?

Answer - 103 : - The Panel and Applet classes use the FlowLayout as their default layout.

Question - 104 : - What are the problems faced by Java programmers who don't use layout managers?

Answer - 104 : - Without layout managers, Java programmers are faced with determining how their GUI will be displayed across multiple windowing systems and finding a common sizing and positioning that will work within the constraints imposed by each windowing system.

Question - 105 : - What is the purpose of the finally clause of a try-catch-finally statement?

Answer - 105 : - The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.

Question - 106 : - Is null a keyword?

Answer - 106 : - The null value is not a keyword.

Question - 107 : - How do you create a read-only collection?

Answer - 107 : - The Collections class has six methods to help out here: 1. unmodifiableCollection(Collection c) 2. unmodifiableList(List list) 3. unmodifiableMap(Map m) 4. unmodifiableSet(Set s) 5. unmodifiableSortedMap(SortedMap m) 6. unmodifiableSortedSet(SortedSet s) If you get an Iterator from one of these unmodifiable collections, when you call remove(), it will throw an UnsupportedOperationException.

Question - 108 : - What is the difference between the File and RandomAccessFile classes?

Answer - 108 : - The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.

Question - 109 : - What is polymorphism?

Answer - 109 : - Polymorphism means "having many forms". It allows methods (may be variables) to be written that needn't be concerned about the specifics of the objects they will be applied to. That is, the method can be specified at a higher level of abstraction and can be counted on to work even on objects of un-conceived classes.

Question - 110 : - Can a lock be acquired on  a class?

Answer - 110 : - Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners