More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
As we haven't specified the type of TreeSet, it being evaluated with the first element insertion. Once it's identified that it's of type String and as no comparator has been defined, the comparison is done using the String compareTo method. String compareTo method compares the elements by the content / value.
Help us improve. Please let us know the company, where you were asked this question :
Ans. float is a native data type whereas Float is a class. A Float object will always take more memory than float variable as there are metadata overheads with the objects.
Help us improve. Please let us know the company, where you were asked this question :
Q2465. Difference between HashMap and WeakHashMap ?
Ans. WeakHashMap uses weak reference for keys, which means if the key object doesn't have any reference then both key/value mapping will become eligible for garbage collection.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Stack memory areas is used to hold method and local variables while objects are always allocated memory in the heap. The heap memory is shared between multiple threads whereas Stack memory isn't.
Help us improve. Please let us know the company, where you were asked this question :
Q2469. When are static and instance methods resolved ? During compile time or Runtime ?
Ans. Static methods are resolved during compile time and hence they cannot participate in runtime polymorphism. Instance methods are resolved during runtime.
Help us improve. Please let us know the company, where you were asked this question :
Ans. BlockingQueue is a Queue that supports operations that wait for the queue to become non-empty when retrieving and removing an element, and wait for space to become available in the queue when adding an element.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Kafka is a distributed, partitioned, replicated commit log service. It provides the functionality of a messaging system through messages being written to logs.
Help us improve. Please let us know the company, where you were asked this question :
Q2481. Have you used Kafka in your project ? If Yes, for what ?
Ans. We were using Kafka as a replacement for JMS Message Queue for better throughput. We were just using a simple Java multi threaded client as order of message consumption didn't matter to us.
Help us improve. Please let us know the company, where you were asked this question :
Q2486. Which access specifiers can be used with top level class ? a. public or default b. public or private c. public or protected d. protected or default
Q2488. Which of the following can be marked static ?
a. Methods , Variables and Initialization Blocks.
b. Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
c. Methods , Variables , Initialization Blocks and Outer Classes.
d. Methods , Variables , Initialization Blocks and nested Classes
Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
Methods , Variables , Initialization Blocks and Outer Classes.
Methods , Variables , Initialization Blocks and nested Classes.
Which of the following cannot be marked static ?
Constructors , Classes ( Outer ) , Classes ( nested ), Interfaces , Local variables , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Interfaces , Local variables , Class variables , Class Methods , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Classes (Nested), Interfaces , Local variables , Inner Class methods and instance variables.
Q2489. Which of the following cannot be marked static ?
a. Constructors , Classes ( Outer ) , Classes ( nested ), Interfaces , Local variables , Inner Class methods and instance variables. b. Constructors , Classes ( Outer ) , Interfaces , Local variables , Class variables , Class Methods , Inner Class methods and instance variables. c. Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables. d. Constructors , Classes ( Outer ) , Classes (Nested), Interfaces , Local variables , Inner Class methods and instance variables
Ans. Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables.
Help us improve. Please let us know the company, where you were asked this question :
Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
Methods , Variables , Initialization Blocks and Outer Classes.
Methods , Variables , Initialization Blocks and nested Classes.
Which of the following cannot be marked static ?
Constructors , Classes ( Outer ) , Classes ( nested ), Interfaces , Local variables , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Interfaces , Local variables , Class variables , Class Methods , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Classes (Nested), Interfaces , Local variables , Inner Class methods and instance variables.
Q2490. Interface can only have ...
a. Member elements and Methods. b. Static Variables and Static Methods. c. Static Final Variables and Instance Method Declarations. d. Member Elements , Instance Methods, Static variables and Static Methods.
Ans. Static Final Variables and Instance Method Declarations.
Help us improve. Please let us know the company, where you were asked this question :