Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed to have the "look and feel" of the C++ language, but it is simpler to use than C++ and enforces an object-oriented programming model. Java can be used to create complete applications that may run on a single computer or be distributed among servers and clients in a network. It can also be used to build a small application module or applet for use as part of a Web page. Applets make it possible for a Web page user to interact with the page.
The major characteristics of Java are:
The programs you create are portable in a networkThe code is robust.Java is object-oriented.In addition to being executed at the client rather than the server, a Java applet has other characteristics designed to make it run fast.
Relative to C++, Java is easier to learn. (However, it is not a language you'll pick up in an evening!)
Java was introduced by Sun Microsystems in 1995 and instantly created a new sense of the interactive possibilities of the Web. Both of the major Web browsers include a Java virtual machine. Almost all major operating system developers (IBM, Microsoft, and others) have added Java compilers as part of their product offerings.
The Java virtual machine includes an optional just-in-time compiler that dynamically compiles bytecode into executable code as an alternative to interpreting one bytecode instruction at a time. In many cases, the dynamic JIT compilation is faster than the virtual machine interpretation.
Core Java Interviews are getting tough these days as the technology grows faster. To get through the Core Java interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed Core Java questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on Core Java and various other technologies interview preparation.
31. Describe the wrapper classes in Java.
Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type. Following table lists the primitive types and the corresponding wrapper classes: Primitive Wrapper boolean - java.lang.Boolean byte - java.lang.Byte char - java.lang.Character double - java.lang.Double float - java.lang.Float int - java.lang.Integer long - java.lang.Long short - java.lang.Short void - java.lang.Void
32. Describe what happens when an object is created in Java?
Several things happen in a particular order to ensure the object is constructed properly: 1. Memory is allocated from heap to hold all instance variables and implementation-specific data of the object and its superclasses. Implemenation-specific data includes pointers to class and method data. 2. The instance variables of the objects are initialized to their default values. 3. The constructor for the most derived class is invoked. The first thing a constructor does is call the consctructor for its superclasses. This process continues until the constrcutor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java. 4. Before the body of the constructor is executed, all instance variable initializers and initialization blocks are executed. Then the body of the constructor is executed. Thus, the constructor for the base class completes first and constructor for the most derived class completes last.
33. 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
34. Difference Between Abstraction and Encapsulation
Abstraction is removing some distinctions between objects, so as to show their commonalities. Encapsulation is hiding the details of the implementation of an object so that there are no external dependencies on the particular implementation.
35. Different types of Transaction Isolation Levels?
The isolation level describes the degree to which the data being updated is visible to other transactions. This is important when two transactions are trying to read the same row of a table. Imagine two transactions A & B. Three types of inconsistencies can occur: · Dirty-read: A has changed a row, but has not committed the changes. B reads the uncommitted data but his view of the data may be wrong if A rolls back his changes and updates his own changes to the database. · Non-repeatable read: B performs a read, but A modifies or deletes that data later. If B reads the same row again, he will get different data. · Phantoms: A does a query on a set of rows to perform an operation. B modifies the table such that a query of A would have given a different result. The table may be inconsistent. TRANSACTION_READ_UNCOMMITTED : DIRTY READS, NON-REPEATABLE READ AND PHANTOMS CAN OCCUR. TRANSACTION_READ_COMMITTED : DIRTY READS ARE PREVENTED, NON-REPEATABLE READ AND PHANTOMS CAN OCCUR. TRANSACTION_REPEATABLE_READ : DIRTY READS , NON-REPEATABLE READ ARE PREVENTED AND PHANTOMS CAN OCCUR. TRANSACTION_SERIALIZABLE : DIRTY READS, NON-REPEATABLE READ AND PHANTOMS ARE PREVENTED.
36. Differentiate between applet and application.
Java applications runs as stand-alone application whereas applet runs in web browser. Application is a Java class that has a main() method. Applet class extends java.applet.Applet class.
37. Diffrence between JRE And JVM AND JDK
38. Do I need to know C++ to learn Java?
No, you don't need to know C or C++ to learn Java. Java is much simpler that C++.
39. Does a class inherit the constructors of its superclass?
A class does not inherit constructors from any of its superclasses.
40. Does garbage collection guarantee that a program will not run out of memory?
No, it doesn't. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection