Core Java Interview Questions – Set 17

What is the difference between an argument and a parameter?

While defining method, variables passed in the method are called parameters. While using those methods, values passed to those variables are called arguments.

What is the difference between the Boolean & operator and the && operator

If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the &operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated.

If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.

What is the difference between the String and StringBuffer classes

String objects are constants. StringBuffer objects are not constants.

Which method of the Component class is used to set the position and size of a component?

setBounds() method is used to set the position and size of a component

Is &&= a valid Java operator

No. It is not a valid java operator.

How can you access protected features from another package

You can access protected features from other classes by subclassing the that

class in another package, but this cannot be done for friendly features

What is BDK

?– BDK, Bean Development Kit is a tool that enables to create, configure and connect a set of set of Beans and it can be used to test Beans without writing a code.

What restrictions are placed on the values of each case of a switch statement

During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.

What class allows you to read objects directly from a stream

The ObjectInputStream class supports the reading of objects from input streams.

How is abstract class different from final class

Abstract class must be subclassed and final class cannot be subclassed