Monday, 13 February 2012

What restrictions are placed on method overriding? | Core Java

Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions that may not be thrown by the overridden method.

What is the difference between the prefix and postfix forms of the ++ operator? | Core Java

The prefix form performs the increment operation and returns the value of the increment operation. The postfix form returns the current value all of the expression and then performs the increment operation on that value.

What is the difference between a public and a non-public class? | Core Java

A public class may be accessed outside of its package. A non-public class may not be accessed outside of its package.

What is numeric promotion? | Core Java

Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place. In numerical promotion, byte, char, and short values are converted to int values. The int values are also converted to long values, if necessary. The long and float values are converted to double values, as required

What is the diffrence between inner class and nested class? | Core Java

When a class is defined within a scope od another class, then it becomes inner class. If the access modifier of the inner class is static, then it becomes nested class.

What are the legal operands of the instanceof operator? | Core Java

The left operand is an object reference or null value and the right operand is a class, interface, or array type.

If a method is declared as protected, where may the method be accessed? | Core Java

A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.