Core Java Interview Questions – Set 22

Is Java Pass by Reference or Pass by Value? The Java Spec says that everything in Java is pass-by-value. There is no such thing as “pass-by-reference” in Java. The difficult thing can be to understand that Java passes “objects as references” passed by value. Which class is the immediate superclass of the Container class Component. … Read more

Core Java Interview Questions – Set 21

What is difference between HashMap and HashSet HashSet : HashSet does not allow duplicate values. It provides add method rather put method. You also use its contain method to check whether the object is already available in HashSet. HashSet can be used where you want to maintain a unique list. HashMap : It allows null for both key … Read more

Core Java Interview Questions – Set 20

Where is native modifier used It can refer only to methods and it indicates that the body of the method is to be found else where and it is usually written in non java language When do you use continue and when do you use break statements When continue statement is applied it prematurely completes … Read more

Core Java Interview Questions – Set 19

What is a stream and what are the types of Streams and classes of the Streams A Stream is an abstraction that either produces or consumes information. There are two types of Streams and they are: Byte Streams: Provide a convenient means for handling input and output of bytes. Character Streams: Provide a convenient means … Read more

Core Java Interview Questions – Set 18

How is rounding performed under integer division The fractional part of the result is truncated. This is known as rounding toward zero. Why are the methods of the Math class static So they can be invoked as if they are a mathematical code library. When are automatic variable initialized Automatic variable have to be initialized … Read more

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 … Read more

Core Java Interview Questions – Set 16

What restrictions are placed on the location of a package statement within a source code file? A package statement must appear as the first line in a source code file (excluding blank lines and comments). What is the immediate superclass of the Dialog class? Window. What is the difference between set and list? Set stores … Read more

Core Java Interview Questions – Set 15

Which characters may be used as the second character of an identifier, but not s the first character of an identifier? The digits 0 through 9 may not be used as the first character of an identifier but they may be used after the first character of an identifier What is an abstract method An … Read more

Core Java Interview Questions – Set 14

What is URL ?– URL stands for Uniform Resource Locator and it points to resource files on the Internet. URL has four components: http://www. address. com:80/index.html, where http – protocol name, address – IP address or host name, 80 – port number and index.html – file path. What is the purpose of the Runtime class? … Read more

Interface Java Interview Questions – Set 13

Which one would you prefer and why The Runnable interface is preferred, as it does not require your object to inherit a thread because when you need multiple inheritance, only interfaces can help you. In the above example we had to extend the Base class so implementing Runnable interface is an obvious choice. Also note how … Read more