-
Which of the following is true about packages?
a) Classes in the same package can access each other.
b) The inherited class should be in the same package as the parent class.
c) Package name a.b implies, package b is inherits from package a.
d) Package access is next to private access in being restrictive. -
Given the two methods:
void f() throws IOException
Which of the following is/are correct overriding method?
a) void f() throws IOException
b) public void f()
c) void f() throws FileNotFoundException
d) void f() throws Exception -
Thread and Runnable
When we will use thread and runnable in java program ?
-
-
-
How is Java considered tamper free?
I read in the properties of java that it is secured as it is tamper free. I would like to know what is tamper free and how it applies to Java?
-
String Input Library
Write a Java program without using any library function in string
i/p: My name is Rama
o/p: Rama si eman yM
-
Single Thread and Multiple Thread
What is difference between Single Thread and Multiple Thread?
Explain Single Thread Model Vs. Multi thread model. Support your answer with practical example? -
Why do threads block on I/O
Threads block on i/o (that is enters the waiting state) so that other threads may executewhile the i/o Operation is performed.
-
What is an Iterator interface
The Iterator interface is used to step through the elements of a Collection.
-
What is the difference between yielding and sleeping
When a task invokes its yield() method, it returns to the ready state. When a task invokesits sleep() method, it returns to the waiting state.
-
What is a native method
A native method is a method that is implemented in a language other than Java.
-
What is the difference between the Boolean & operator and the && operator
If an expression involving the Boolean & operator is evaluated, both operands areevaluated. Then the & operator is applied to the operand. When an expression involvingthe && operator is evaluated, the first operand is evaluated. If the first operand returns avalue of true then the second operand is evaluated. The && operator is then applied tothe first and second operands. If the first operand evaluates...
-
What is the purpose of the Runtime class
The purpose of the Runtime class is to provide access to the Java runtime system.
-
How many times may an object's finalize() method be invoked by thegarbage collector
An object's finalize() method may only be invoked once by the garbage collector.
-
Can a double value be cast to a byte
Yes, a double value can be cast to a byte.
-
-
What modifiers can be used with a local inner class
A local inner class may be final or abstract.
-
Can try statements be nested
Try statements may be tested.
-
How does a try statement determine which catch clause should be used to handle anexception
When an exception is thrown within the body of a try statement, the catch clauses of thetry statement are examined in the order in which they appear. The first catch clause that iscapable of handling the exception is executed. The remaining catch clauses are ignored.
Java Interview Questions
Ans