May 9, 2019

Srikaanth

Facebook Core Java Interview Questions Answers

What Is Java Literals?

Literals correspond to a specific value in your Java program. For example, if you type the number 7 (the literal number 7) in a Java program, Java will treat the value as an int type. If you use the character JC within single quotes (V), Java will treat it as a char type. Likewise, if you place the literal x within double quotes Ox'), Java will treat it as a String. Depending on the literal you are using, Java provides special rules for hexadecimal, octal, characters, strings and boolean values. As you will learn, you can force a literal to be a certain type. For example, Java will treat the number 1 as an int. But you can force Java to treat the value as the type long by appending the L character to the literal number: 1L.

What Is The Primitive Type Byte?

A byte is a primitive Java data type that uses eight bites to represent a number ranging from -128 to 127. The following statements declare two byte variables. The first variable, flag_bits, can store one value. The second byte variable, data_table, is an array, capable of holding four values. In this case, the Java compiler will preassign the array elements using the values specified between the left and right braces

byte flag__bits;
byte data__table = { 32, 16, 8, 4 }; // Creates an array.

What Is The Primitive Type Short?

The type short is a primitive Java data type that uses two bytes to represent a number in the range -32768 to 32767. The Java type short is identical to the two-byte hit in many C/C++ compilers.
The following statements declare two variables of type short
short age;
short height, width;

Why Call By Value Prevents Parameter Value Change?

When you pass primitive types such as the types float, boolean, hit and char to a method, Java passes the variables by value. In other words, Java makes a copy of the original variable which the method can access and the original remains unchanged. Within a method, the code can change the values as much as it needs because Java created these values as copies of the originals.
Wherever you pass a primitive type as a parameter to a method, Java copies this parameter to a special memory location known as the stack. The stack maintains information about variables used by the method while the method executes. When the method is complete, Java discards the stack's contents and the copies of the variables you passed into the method are gone forever.
Because Java copies your original primitive type parameters, there is never any danger of a method altering your original values. Remember, this only applies to primitive types, which are automatically passed by value. Objects and arrays are not passed by value (instead they are passed by reference) and they are in danger of being changed.
Facebook Most Frequently Asked Latest Core Java Interview Questions Answers
Facebook Most Frequently Asked Latest Core Java Interview Questions Answers

What Is Remote Method Invocation (rmi)?

As you develop more complicated Java applets, and as other developers publish their own applet, you may find that you need to have your Java objects invoke other Java object methods residing on other computers. This is a natural extension of Java—you are able to use Java-based resources throughout the Web to give your applet additional functionality. Remote Method Invocation (RMI) lets methods within your Java objects be invoked from Java code that may be running in a different virtual machine, often on another computer.

What Is Java Jit Compilers?

When your Java-enabled browser connects to a server and tries to view a Web page that contains a Java applet, the server transmits the bytecode for that applet to your computer. Before your browser can run the applet, it must interpret the bytecode data. The Java interpreter performs the task of interpreting the bytecode data.
As you have learned, using an interpreter to read bytecode files makes it possible for the same bytecode to run on any computer (such as a Window-based or Mac-based computer) that supports Java. The big drawback is that interpreters can be 20 to 40 times slower than code that was custom or native, for a specific computer.
As it turns out, a new type of browser-side software, called a Just-In-Time compiler (JIT), can convert (compile) the bytecode file directly into native code optimized for the computer that is browsing it. The JIT compiler will take the bytecode data sent by the server and compile it just before the applet needs to run. The compiled code will execute as fast as any application you already use on your computer. As you might expect, the major compiler and IDE manufacturers, such as Borland, Microsoft, Symantec and Metroworks, are all developing JIT compilers.

What Is The Java Idl System?

The Interface Definition Language (IDL) is an industry standard format useful for letting a Java client transparently invoke existing IDL object that reside on a remote server. In addition, it allows a Java server to define objects that can be transparently invoked from IDL clients. The Java IDL system lets you define remote interfaces using the IDL interface definition language which you can then compile with the idlgen stub generator tool to generate Java interface definitions and Java client and server stubs.

What Is Java Beans?

Java Beans is the name of a project at JavaSoft to define a set of standard component software APIs (Application Programmers Interface) for the Java platform. By developing these standards, it becomes possible for software developers to develop reusable software components that end-users can then hook together using application-builder tools. In addition, these API's make it easier for developers to bridge to existing component models such as Microsoft's ActiveX, Apple's OpenDoc and Netscape's LiveConnect.

What Is Object-oriented Programming?

To programmers, an object is a collection of data and methods are a set of operations that manipulate the data. Object-oriented programming provides a way of looking at programs in terms of the objects (things) that make up a system. After you have identified your system's objects, you can determine the operations normally performed on the object. If you have a document object, for example, common operations might include printing, spell-checking, faxing or even discarding.

Object-oriented programming does not require a special programming language such as Java.You can write object-oriented programs in such languages as C++ or Java or C#. However, as you will learn, languages described as "object-oriented" normally provide class-based data structures that let your programs group the data and methods into one variable. Objects-oriented programming has many advantages, primarily object reuse and ease of understanding. As it turns out, you can often use the object that you write for one program in another program. Rather than building a collection of function libraries, object-oriented programmers build class libraries. Likewise, by grouping an object's data and methods, object-oriented programs are often more readily understood than their non-object- based counterparts.

What Is Abstraction?

Abstraction is the process of looking at an object in terms of its methods (the operations), while temporarily ignoring the underlying details of the object's implementation. Programmers use abstraction to simplify the design and implementation of complex programs. For example, if you are told to write a word processor, the task might at first seem insurmountable. However, using abstraction, you begin to realize that a word processor actually consists of objects such as a document object that users will create, save, spell-check and print. By viewing programs in abstract terms, you can better understand the required programming. In Java, the class is the primary tool for supporting abstraction.

What Is Encapsulation?

As you read articles and books about object-oriented programming and Java, you might encounter the term encapsulation. In the simplest sense, encapsulation is the combination of data and methods into a single data structure. Encapsulation groups together all the components of an object. In the "object-oriented" sense, encapsulation also defines how your programs can reference an object's data. Because you can divide a Java class into public and private sections; you can control the degree to which class users can modify or access the class data. For example, programs can only access an object's private data using public methods defined within the class. Encapsulating an object's data in this way protects the data from program misuses. In Java, the class is the fundamental tool for encapsulation.

How Does The Application Server Handle The Jms Connection?

App server creates the server session and stores them in a pool.
Connection consumer uses the server session to put messages in the session of the JMS.
Server session is the one that spawns the JMS session.
Applications written by the Application programmers creates the message listener.

What Is A Superclass?

When you derive one class from another in Java, you establish relationships between the various classes. The parent class (or the class it is being derived from) is often called the superclass or base class. The superclass is really an ordinary class which is being extended by another class. In other words, you do not need to do anything special to the class in order for it to become a superclass. Any of the classes you write may some day become a superclass if someone decides to create a new subclass derived from your class.

Of course, you can prevent a class from becoming a superclass (that is, do not allow it to be extended). If you use the final keyword at the start of the class declaration, the class cannot be extended.

Explain The Abstract Class Modifier?

As you have learned, Java lets you extend an existing class with a subclass. Over time, you may start to develop your own class libraries whose classes you anticipate other programmers will extend. For some classes, there may be times when it does not make sense to implement a method until you know how a programmer will extend the class. In such cases, you can define the method as abstract, which forces a programmer who is extending the class to implement the method.

When you use the abstract keyword within a class, a program cannot create an instance of that class. As briefly discussed, abstract classes usually have abstract methods which the class did not implement. Instead, a subclass extends the abstract class and the subclass must supply the abstract method's implementation. To declare a class abstract, simply include the abstract keyword within the class definition, as shown

public abstract class Some abstract Class
{
}

What Is The Final Class Modifier?

As you have learned, Java lets one class extend another. When you design a class, there may be times when you don't want another programmer to extend the class. In such cases, by including the final keyword within a class definition, you prevent the class from being subclassed. The following statement illustrates the use of the final keyword within a class definition

public final class TheBuckStopsHere
{
}

Explain The Public Class Modifier.

As you develop Java programs, there may be times when you create classes that you don't want the code outside of the class package (the class file) to access or even to have the knowledge of.
When you use the public keyword within a class declaration, you make that class visible (and accessible) everywhere. A non-public class, on the other hand, is visible only to the package within which it is defined. To control access to a class, do not include the public keyword within the class declaration. Java only lets you place one public class within a source-code file. For example, the following statement illustrates the use of the public keyword within a class

public class ImEverywhereYouWantMeToBe
{
}

What Is The Public Field Modifier?

A variable's scope defines the locations within a program where the variable is known. Within a class definition, you can control a class member variable's scope by preceding a variable's declaration with the public, private or protected keywords. A public variable is visible (accessible) everywhere in the program where the class itself is visible (accessible). To declare a variable public, simply use the public keyword at the start of the variable declaration, as shown
public int seeMeEveryWhere;

Explain The Private Field Modifier?

To control a class member variable's scope, you can precede the variable's declaration with the public, private or protected key words. A private variable is only visible within its class. Subclasses cannot access private variables. To declare a variable private, simply use the private keyword at the start of the variable declaration, as shown
private int InvisibleOutside;

Explain The Protected Field Modifier?

To control a class member variable's scope, you can precede the variable's declaration with the public, private ox protected keywords. A protected variable is one that is only visible within its class, within subclasses or within the package that the class is part of. The different between a private class member and a protected class member is that & private class member is not accessible within a subclass. To declare a variable protected, simply use the protected keyword at the start of the variable declaration, as shown protected int ImProtected;

https://mytecbooks.blogspot.com/2019/05/facebook-most-frequently-asked-latest.html
Subscribe to get more Posts :