October 16, 2018

Srikaanth

OpenText Most Frequently Asked Core Java Interview Questions Answers

How Is Rounding Performed Under Integer Division?

The fractional part of the result is truncated. This is known as rounding toward zero.

If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?

A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

Does A Class Inherit The Constructors Of Its Superclass?

A class does not inherit constructors from any of its superclasses.

Name The Eight Primitive Java Types.

The eight primitive types are byte, char, short, int, long, float, double, and boolean.

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 Is The Difference Between A While Statement And A Do Statement?

A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

What Modifiers Can Be Used With A Local Inner Class?

A local inner class may be final or abstract.

When Does The Compiler Supply A Default Constructor For A Class?

The compiler supplies a default constructor for a class if no other constructors are provided.

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 or by subclasses of the class in which it is declared.

What Are The Legal Operands Of The Instanceof Operator?

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

Are True And False Keywords?

The values true and false are not keywords.

What Happens When You Add A Double Value To A String?

The result is a String object.
OpenText Most Frequently Asked Core Java Interview Questions Answers
OpenText Most Frequently Asked Core Java Interview Questions Answers

What Is The Diffrence Between Inner Class And Nested Class?

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.

Can An Abstract Class Be Final?

An abstract class may not be declared as final.

What Is Numeric Promotion?

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 Difference Between A Public And A Non-public Class?

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

To What Value Is A Variable Of The Boolean Type Automatically Initialized?

The default value of the boolean type is false

What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator?

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 Restrictions Are Placed On Method Overriding?

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 A Java Package And How Is It Used?

A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces. Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces.

What Modifiers May Be Used With A Top-level Class?

A top-level class may be public, abstract, or final.

What Is The Difference Between An If Statement And A Switch Statement?

The if statement is used to select among two alternatives. It uses a boolean expression to decide which alternative should be executed. The switch statement is used to select among multiple alternatives. It uses an int expression to determine which alternative should be executed.

Can A Method Be Overloaded Based On Different Return Type But Same Argument Type ?

No, because the methods can be called without using their return type in which case there is ambiquity for the compiler

What Happens To A Static Var That Is Defined Within A Method Of A Class ?

Can't do it. You'll get a compilation error

How Many Static Init Can You Have ?

As many as you want, but the static initializers and class variable initializers are executed in textual order and may not refer to class variables declared in the class whose declarations appear textually after the use, even though these class variables are in scope.

What Is The Difference Between Method Overriding And Overloading?

Overriding is a method with the same name and arguments as in a parent, whereas overloading is the same method name but different arguments

What Is Constructor Chaining And How Is It Achieved In Java ?

A child object constructor always first needs to construct its parent (which in turn calls its parent constructor.). In Java it is done via an implicit call to the no-args constructor as the first statement.

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.

Which Java Operator Is Right Associative?

The = operator is right associative.

Can A Double Value Be Cast To A Byte?

Yes, a double value can be cast to a byte.

What Is The Difference Between A Break Statement And A Continue Statement?

A break statement results in the termination of the statement to which it applies (switch, for, do, or while). A continue statement is used to end the current loop iteration and return control to the loop statement.

https://mytecbooks.blogspot.com/2018/10/opentext-most-frequently-asked-core.html
Subscribe to get more Posts :