0
Q:

Which of the following statements are equal for a variable declared in the interface ?

1. int X=10
2. public int X=10
3. public static final int X=10

A) Only 1 and 2 are equal B) Only 2 and 3 are equal
C) All are unequal D) All are equal

Answer:   D) All are equal



Explanation:

All the statements are equal because inside an interface a variable declared will be public static final by default 

Subject: Java
Job Role: IT Trainer
Q:

If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

Answer

The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 7856
Q:

Which of the following modifiers can be used with Local inner class?

A) Final or Abstract B) Final or Transcient
C) Abstract or Transcient D) Final or public
 
Answer & Explanation Answer: A) Final or Abstract

Explanation:

It can either be Final or Abstract

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2593
Q:

A lock can be acquired on a class.

The above statement is

A) True B) False
C) Both A and B D) None
 
Answer & Explanation Answer: A) True

Explanation:

A lock can be acquired on a class. This lock is acquired on the class's Class object.

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 12216
Q:

Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent  Postfix notations.

A) AC + B * DE - FG +^- B) AB + C * DE - FG + ^-
C) AC + B* DE - FG -+ ^ D) AB + C * DE - FG -+ ^
 
Answer & Explanation Answer: B) AB + C * DE - FG + ^-

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Java

4 4107
Q:

What are the various elements of OOPS?

Answer

Various elements of OOP are:


• Object


• Class


• Method


• Encapsulation


• Information Hiding


• Inheritance


• Polymorphism

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1641
Q:

try { int x = Integer.parseInt("two"); }

Which could be used to create an appropriate catch block?

A) ClassCastException B) IllegalStateException
C) NumberFormatException D) None
 
Answer & Explanation Answer: C) NumberFormatException

Explanation:

C is correct. 'Integer.parseInt' can throw a NumberFormatException, and IllegalArgumentException is its superclass 

Report Error

View Answer Report Error Discuss

Filed Under: Java

3 27537
Q:

class Hell {

public static void main(String[] args) {

Integer i = 42;

String s = (i<40)?"life":(i>50)?"base":"ball";

System.out.println(s);

}

}

A) null B) ball
C) base D) None
 
Answer & Explanation Answer: B) ball

Explanation:

D is correct. This is a ternary nested in a ternary with a little unboxing thrown in.Both of the ternary expressions are false.

Report Error

View Answer Report Error Discuss

Filed Under: Java

1 31908
Q:

Which method names follow the JavaBeans standard?

A) addSize B) putDimensions
C) getCust D) deleteRep
 
Answer & Explanation Answer: C) getCust

Explanation:

C use the valid prefixes 'get' and 'is

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 7433