June 24, 2019

Srikaanth

Apigee Frequently Asked Core Java Interview Questions

Apigee Most Frequently Asked Core Java Interview Questions Answers

Explain About The Select Method With An Example?

Select part is useful in selecting text or part of the text. Arguments specified for the select command are the same as applicable to substring. First index is usually represents the start of the index. End of line makers are counted as one character. Example t.select (10,15) .

Can There Be An Abstract Class With No Abstract Methods In It?

Yes.

Can We Define Private And Protected Modifiers For Variables In Interfaces?

No.

What Is Garbage Collection? What Is The Process That Is Responsible For Doing That In Java?

Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process.

Can There Be An Abstract Class With No Abstract Methods In It?

Yes.

Can An Interface Have An Inner Class?

Yes.

public interface abc {
static int i=0;
void dd();
class a1 {
a1() {
int j;
System.out.println("in interfia");
};
public static void main(String a1[]) {
System.out.println("in interfia"); } } }

What Is User Defined Exception?

Apart from the exceptions already defined in Java package libraries, user can define his own exception classes by extending Exception class.
Apigee Most Frequently Asked Core Java Interview Questions Answers
Apigee Most Frequently Asked Core Java Interview Questions Answers

What Is The Difference Between Logical Data Independence And Physical Data Independence?

Logical Data Independence - meaning immunity of external schemas to changed in conceptual schema.

Physical Data Independence - meaning immunity of conceptual schema to changes in the internal schema.

What Are The Practical Benefits, If Any, Of Importing A Specific Class Rather Than An Entire Package (e.g. Import Java.net.* Versus Import Java.net.socket)?

It makes no difference in the generated class files since only the classes that are actually used are referenced by the generated class file. There is another practical benefit to importing single classes, and this arises when two (or more) packages have classes with the same name. Take java.util.Timer and javax.swing.Timer, for example. If I import java.util.* and javax.swing.* and then try to use "Timer", I get an error while compiling (the class name is ambiguous between both packages). Let’s say what you really wanted was the javax.swing.Timer class, and the only classes you plan on using in java.util are Collection and HashMap. In this case, some people will prefer to import java.util.Collection and import java.util.HashMap instead of importing java.util.*. This will now allow them to use Timer, Collection, HashMap, and other javax.swing classes without using fully qualified class names in.

How Many Methods Do U Implement If Implement The Serializable Interface?

The Serializable interface is just a "marker" interface, with no methods of its own to implement. Other ’marker’ interfaces are
java.rmi.Remote
java.util.EventListener

What Does The "abstract" Keyword Mean In Front Of A Method? A Class?

Abstract keyword declares either a method or a class. If a method has a abstract keyword in front of it,it is called abstract method.Abstract method has no body.It has only arguments and return type.Abstract methods act as placeholder methods that are implemented in the subclasses.

Abstract classes can’t be instantiated.If a class is declared as abstract,no objects of that class can be created.If a class contains any abstract method it must be declared as abstract.

You Can Create A String Object As String Str = "abc"; Why Cant A Button Object Be Created As Button Bt = "abc";? Explain

The main reason you cannot create a button by Button bt= "abc"; is because "abc" is a literal string (something slightly different than a String object, by-the-way) and bt is a Button object. The only object in Java that can be assigned a literal String is java.lang.String. Important to note that you are NOT calling a java.lang.String constuctor when you type String s = "abc";

Can Rmi And Corba Based Applications Interact ?

Yes they can. RMI is available with IIOP as the transport protocol instead of JRMP.

What Is Passed By Reference And Pass By Value ?

All Java method arguments are passed by value. However, Java does manipulate objects by reference, and all object variables themselves are references.

What Is A "stateless" Protocol ?

Without getting into lengthy debates, it is generally accepted that protocols like HTTP are stateless i.e. there is no retention of state between a transaction which is a single request response combination.

Difference Between A Class And An Object ?

A class is a definition or prototype whereas an object is an instance or living representation of the prototype.

What Are The Four Corner Stones Of Oop?

Abstraction, Encapsulation, Polymorphism and Inheritance.

What Gives Java It's "write Once And Run Anywhere" Nature?

Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform. After being fed to the JVM, which is specific to a particular operating system, the code platform specific machine code is generated thus making java platform independent.

How Can A Dead Thread Be Restarted?

A dead thread cannot be restarted.

Subscribe to get more Posts :