-
What is the output of below syntax?
java{
cath(Exception e)
{System.out.println("A");
}
cath(ClassNotFoundException e1)
{System.out.println("b");
}
cath(InvalidException e2)
{System.out.println("c");
}
finally()
{
System.out.println("x");
}
-
What will be the result of compiling and executing the code listed below?
java
public class Finder {
public static void main(String[] args){
System.out.println(X.Y.Z);
}}
class X{
static class Y{ static String Z ="Apple"; }
static W Y = new W();
}
class W{ String Z = "Orange";}
a) Apple
b) Orange
c) Compile time Error
d) Runtime Exception is thrown -
What is the output of the following program?
class Test{
public static void main(String [] args){
int a=8;
a=--a+a--+a++;
System.out.println(a );
}} -
Java supports multiple inheritance
Skill/Topic: InheritanceA) TrueB) False
-
-
Does a class inherit the constructors of its superclass
A class does not inherit constructors from any of its superclasses.
-
There are _____ types of Comments in Java
A) One B) Two C) ThreeD) Four Explanation: There are 3 types of comments namely Single-line, Multi-line and Documentation comment
-
-
-
-
What is the data type for the parameter of the sleep() method?
A) doubleB) intC) longD) float
-
-
-
-
What are the functions of the dot(.) operator? (Select multiple)
A) It enables you to access instance variables of any objects within a classB) It enables you to store values in instance variables of an objectC) It is used to call object methodsD) It is to create a new object
-
____________ is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse
A) EncapsulationB) ClassC) InheritenceD) Polymorphism
-
-
What is the difference between exception and error
Answered by Scott on 2005-05-12 09:50:36: An Exception can be caught and recovered: ArrayIndexOutOfBoundsException means you tried to access a position of an Array that does not exist - no big deal. An Error is unrecoverable: OutOfMemoryError means that the JVM has no more memory to contin
-
An _________ is a special kind of Java program that is designed to be transmitted over the Internet
A) ViewletB) AppletC) ServletD) Object
-
Java support RMI. What does this RMI stands for?
A) Random Memory InterfaceB) Remote Method InvocationC) Random Method InvocationD) Ramote Memory Interface
Java Interview Questions
Ans