z Core Java Interview Questions | Eklavya Online

z Core Java Interview Questions

Learn About Java Technology

To date, the Java platform has attracted more than 6.5 million software developers. It’s used in every major industry segment and has a presence in a wide range of devices, computers, and networks. Java technology’s versatility, efficiency, platform portability, and security make it the ideal technology for network computing. From laptops to datacenters, game consoles to scientific supercomputers, cell phones …

Learn About Java Technology Read More »

How does the version control process works?

Initiate, pull, branch, merge, commit, push. (Init) Make your own repository. (Pull) Download an existing repository from a url. (Branch / Merge )Make revisions. Commit then push your modifications.

What is the difference between JAR and WAR files?

JAR files (Java ARchive) allows aggregating many files into one, it is usually used to hold Java classes in a library. WAR files (Web Application aRchive) stores XML, java classes, and JavaServer pages for Web Application purposes.

What is the difference between JDK and JRE?

Java Development Kit (JDK) is the most widely used Java Software Development Kit. Java Runtime Environment (JRE) is an implementation of the Java Virtual Machine which executes Java programs.

Number the bits, used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?

Unicode requires 16 bits ASCII require 7 bits. but it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns. Define reflection Reflection allows program related access to information about the fields, methods and constructors of loaded classes It use reflected fields, …

Number the bits, used to represent Unicode, ASCII, UTF-16, and UTF-8 characters? Read More »

What is a modulo operator %

This operator gives the value which is related to the remainder of a divisione.g x=7%4 gives remainder 3 as an answer

Where can static modifiers be used

They can be applied to variables, methods and even a block of code, static methods and variables are not associated with any instance of class

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 purpose of the enableEvents() method

The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.

How are this and super used

this is used to refer to the current object instance. super is used to refer to the variables and methods of the superclass of the current object instance.

What are the rules for overriding

Private method can be overridden by private, friendly, protected or public methods. Friendly method can be overridden by friendly, protected or public methods. Protected method can be overridden by protected or public methods. Public method can be overridden by public method

What is UNICODE?-

Unicode is used for internal representation of characters and strings and it uses 16 bits to represent each other.

What is JVM (Java Virtual Machine) ?

JVM stands for Java Virtual Machine. It’s an abstract computer or virtual computer which runs the compiled java programs. Actually JVM is a software implementation which stands on the top of the real hardware platform and operating system. It provides abstraction between the compiled java program and the hardware and operating system. So the compiled …

What is JVM (Java Virtual Machine) ? Read More »

What is an I/O filter?-

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

What is Inet address

?– Every computer connected to a network has an IP address. An IP address is a number that uniquely identifies each computer on the Net. An IP address is a 32-bit number.

How to create a immutable object in Java? Does all property of immutable object needs to be final?

  To create a object immutable You need to make the class final and all its member final so that once objects gets crated no one can modify its state. You can achieve same functionality by making member as non final but private and not modifying them except in constructor. Also its NOT necessary to …

How to create a immutable object in Java? Does all property of immutable object needs to be final? Read More »

What is a Java Bean?-

A Java Bean is a software component that has been designed to be reusable in a variety of different environments

What is the difference between class variable, member variable and automatic(local) variable

class variable is a static variable and does not belong to instance of class but rather shared across all the instances – member variable belongs to a particular instance of class and can be called from any method of the class – automatic or local variable is created on entry to a method and has …

What is the difference between class variable, member variable and automatic(local) variable Read More »

How can you reference static variables

Via reference to any instance of the class Code: Computer comp = new Computer (); comp.harddisk where hardisk is a static variable comp.compute() where compute is a method

What are E and PI

E is the base of the natural logarithm and PI is mathematical value pi.

What are access modifiers

: These public, protected and private, these can be applied to class, variables, constructors and methods. But if you don�t specify an access modifier then it is considered as Friendly

What is an abstract class?-

An abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete

Why main() in java is declared as public static void main? What if the main method is declared as private?

Public – main method is called by JVM to run the method which is outside the scope of project therefore the access specifier has to be public to permit call from anywhere outside the application static – When the JVM makes are call to the main method there is not object existing for the class …

Why main() in java is declared as public static void main? What if the main method is declared as private? Read More »

What is a Jar file

Jar file allows to efficiently deploying a set of classes and their associated resources. The elements in a jar file are compressed, which makes downloading a Jar file much faster than separately downloading several uncompressed files. The package java. util. zip contains classes that read and write jar files

What is the % operator

It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second operand.

What is the ResourceBundle class

The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program’s appearance to the particular locale in which it is being run.

What are different types of operators in Java

– Uniary ++, –, +, -, |, ~, () – Arithmetic *, /, %,+, – -Shift <<, >>, >>> – Comparison =, instanceof, = =,!=Bitwise &, ^, |Short Circuit &&, || Ternary ?:Assignment =

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’s the use of JAVAP tool ?

javap disassembles compiled Java files and spits out representation of the Java program. This is a useful option when the original source code is not available.

What an I/O filter

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

What is a StringBuffer class and how does it differs from String class?

StringBuffer is a peer class of String that provides almost all functionality of strings. String represents fixed-length, immutable character sequences. Comparatively StringBuffer represents mutable, growable and writeable character sequences. But StringBuffer does not create new instances as string so it’s more efficient when it comes to intensive concatenation operation.

How are the elements of a GridBagLayout organized?

The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes The elements of a GridBagLayout are of equal size and are laid out using the squares of a grid.

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 …

What is the difference between the Boolean & operator and the && operator Read More »

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 is source and listener

source : A source is an object that generates an event. This occurs when the internal state of that object changes in some way. listener : A listener is an object that is notified when an event occurs. It has two major requirements. First, it must have been registered with one or more sources to …

What is source and listener Read More »

What is method overloading and method overriding

Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding.

What is clipping?

Clipping is the process of confining paint operations to a limited area or shape.

What are inner class and anonymous class?-

Inner class : classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private. Anonymous class : Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors.

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 for handling input & output of characters. Byte Streams classes: Are defined by using two abstract …

What is a stream and what are the types of Streams and classes of the Streams Read More »

What is stored procedure?-

?– Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures are used to encapsulate a set of operations or queries to execute on database. Stored procedures can be compiled and executed with different parameters and results and may have any combination of input/output parameters.

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.

Can an unreachable object become reachable again

An unreachable object may become reachable again. This can happen when the object’s finalize() method is invoked and the object performs an operation which causes it to become accessible to reachable objects.

What is the difference between procedural and object-oriented programs?

In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code. b) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object …

What is the difference between procedural and object-oriented programs? Read More »

What is static initializer code

: A class can have a block of initializer code that is simply surrounded by curly braces and labeled as static e.g. Code: public class Demo{ static int =10; static{ System.out.println(�Hello world�); } } And this code is executed exactly once at the time of class load

What is Connection pooling? What are the advantages of using a connection pool

Connection Pooling is a technique used for sharing the server resources among requested clients. It was pioneered by database vendors to allow multiple clients to share a cached set of connection objects that provides access to a database. Getting connection and disconnecting are costly operation, which affects the application performance, so we should avoid creating …

What is Connection pooling? What are the advantages of using a connection pool Read More »

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

What is the Properties class

The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.

Explain modifier final

: Final can be applied to classes, methods and variables and the features cannot be changed. Final class cannot be subclassed, methods cannot be overridden.