Core Java Interview Question and Answers

Here are few Q & A from Core Java :


1.Can we say null as keyword?
Ans:Null is not a keyword.

2.What is shortcut way to convert any non –string data to string?
Ans:We an convert any non string data to sting by concatenating "" (Double Quotation)
Ex int num=123;
String S;
S=num+"";

3.What is the Collections API?
Ans:The Collections API (Application Programming Interface) is a set of classes and interfaces that support operations on collections of objects.

4.Which characters can be the second character of an identifier (variables, constants, class name etc) but not as the first character of an identifier?
Ans:0 to 9 digits can be used as second character of identifier but can not use as first character of the identifier.

Ex.
Int N1; // is a legal variable
Int 1N; //is not a legal l name compiler generates an error.

5.What is List interface in Java?
Ans:The List interface provides support for ordered collections of objects and various methods to manipulate list.

6.What is the difference between the >> and >>> operators?
Ans:The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out.

7.What is InstanceOf operator?
Ans:InstanceOf operator use to identify whether the object belongs to specified class or not at Runtime.

Syntax:
Object InstanceOf Class
Returns True if object belongs to class otherwise returns False.

8.Sizeof is a keyword?
Ans:Sizeof is dot a keyword.

9.What is full form of J2SE, J2EE and J2ME?
Ans:
J2SE- Java 2 Standard Edition
J2EE- Java 2 Enterprise Edition
J2ME-Java 2 Micro Edition

10.Which operator in java is right associative?
Ans:The = operator is right associative.

11.Which type of argument main() method takes at run time in java?
Ans:Main() method takes String array argument at run time.
Class abc
{
Public static void main(String args[])
{
}
}

12.List the primitive datatypes in java?
Ans:The eight primitive types are byte, char, short, int, long, float, double, and boolean.

13.Is "xyz" is a primitive value?
Ans:"xyz" is not a primitive value. Is a string literal.

14.List all reference data type.
Ans:Class, Interface, Enumeration, Array.

15.What is casting?
Ans:Casting is the process of conversion from one type of data to another type of data. Conversion of smaller type of data to larger type of data is called widening and larger type of data to smaller type of data is called narrowing.

Int to Double (Widening)
Double to Int (Narrowing)

16.What is the return type of main() method?
Ans:Main() method has void return type.

17.Which type of main() method is and why?c
Ans:Main() is static type of method because at the runtime main method is called using class name by the java Runtime Environment.

18.Are true and false keywords?
Ans:The values true and false are not keywords.

19.Which package is always imported by default?
Ans:Java.lang package is imported by default always.

20.What is the full form of JVM?
Ans:JVM stands to Java Virtual Machine.

Replies

  • born_star16
    born_star16
    Very interesting questions. Thanks a lot for this one. 😁

  • vinci
    vinci
    nice questions ...put some more harder to answer for us .😁

You are reading an archived discussion.

Related Posts

'Customer is the King' - Is the statement still valid?1. You have to assume that you are one of the members of a real GD. 2. Members of a GD...
Happy Programmers's Day to all Programmers out there.....😁😁 Programmers' Day - Wikipedia, the free encyclopedia
What is meant by motor stall protection?????😡😡😡😡
hi to all i am new here but i have seen that all engineers here are CrazyEngineers and i also want to be like all of you.
Many CS & IT Students have this subject. The books I have heard of are: 1. Digital Signal Processing: Alen V.Oppenheim and W.Schaffer 2. Digital Signal Processing: Proskies and Morialkies...