-
-
If a method is declared as protected, where may the method be accessed
A protected method may only be accessed by classes or interfaces of the same package orby subclasses of the class in which it is declared.
-
-
-
-
Managing Inheritance relationship between Classes and Sub-classes
The central new idea in OOP is to allow classes to express similarities among objects that share some, but not all, of their structure and behavior. Such similarities can be expressed using inheritance and polymorphism. Explain how the special variables this and super help manage the inheritance relationship between classes and sub-classes. Do they (i.e., this and super) also help polymorphism? Explain....
-
What do you mean by static methods?
By using the static method there is no need creating an object of that class to use that method. We can directly call that method on that class. For example, say class A has static function f(), then we can call f() function as A.f(). There is no need of creating an object of class A.
-
Can a reference variable of Interface calls and equals method of Object call? If so, why?
javainterface X{
void m1();
void m2();
}
class Child2 extends Object implements X {
public void m1(){
System.out.println("Child2 M1");
}
public void m2(){
System.out.println("Child2 M2");
}
}
public class ParentChildInfterfaceDemo {
public static void main(String[] args){
X... -
What is output of the following Java program?
i want output of this program:
javaimport javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Assimilator
{
public static void main(String[] args)
{
try
{
Properties props = new Properties();
props.put("mail.hosst", "mail.Pmc Tech.org");
Session mailConnection=Session.hetInstance(props,... -
-
-
Which one of the following is NOT a configurable JVM option?
Choice 1: Collect profiling and debugging statistics. Choice 2: Modify the number of bits a double variable uses. Choice 3 : Set the initial memory allocation pool size. Choice 4 :Modify the garbage collector's behavior. Choice 5 :Set the maximum memory allocation pool size.
-
When might your program wish to run the garbage collecter? (Select multiple)
A) before it enters a compute-intense section of codeB) before it enters a memory-intense section of codeC) before objects are finalizedD) when it knows there will be some idle time
-
-
Is the ternary operator written x : y ? z or x ? y : z ?
It is written x ? y : z.
-
What are the two ways to create the thread?
A) by implementing RunnableB) by extending ThreadC) Both a and bD) None of the above
-
-
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.
-
-
Java Interview Questions
Ans