This is a discussion on Java/J2EE interview Questions within the Interview Questions & Answers and Tips forums, part of the DiscussWeb IT Curriculum category; Hey guys, Let us discuss Java/J2EE interview Question... What is JVM (Java Virtual Machine)? Twist: - What are Java Byte ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hey guys, Let us discuss Java/J2EE interview Question... What is JVM (Java Virtual Machine)? Twist: - What are Java Byte Codes? JVM stands for Java Virtual Machine. It’s an abstract computer or virtual computer whichruns the compiled java programs. Actually JVM is a software implementation which standson the top of the real hardware platform and operating system. It provides abstractionbetween the compiled java program and the hardware and operating system. So the compiled program does not have to worry about what hardware and operatingsystem he has to run in, it’s all handled by the JVM and thus attaining portability. All Javaprograms are compiled in to bytecodes. JVM can only understand and execute Javabytecodes. You can visualize Java bytecodes as machine language for JVM. Java compilertakes the .java files and compiles it to a “bytecode” file with .class file extension. Compilergenerates one class file for one source file.
__________________ Venkat knowledge is Power |
|
#2
| |||
| |||
| what is the difference between StringBuilder and StringBuffer class? It is very much similar to StringBuffer except for one difference: it is not synchronized,which means that it is not thread-safe. The advantage of StringBuilder is good performance.In case of multithreading, you must use StringBuffer rather than StringBuilder.
__________________ Venkat knowledge is Power |
|
#3
| |||
| |||
| hey guys, What are the situations you will need a constructor to be private? Below are some of the situations when you will need a constructor to be private:- To implement singleton pattern. That means only one instance of the object need tobe running. When classes contain static methods. It makes sense that no object of the class needto be created. If classes have only constants.
__________________ Venkat knowledge is Power |
|
#4
| |||
| |||
| hey, Define casting? What are the different types of Casting? Changing the type of the value from one type to other is termed as casting. For instancelook at the below code snippet in which we are trying to cast integer value to double datatype. int i; double d; i = 10; d = i; // we are trying to assign a int value to double There are two types of casting explicit and implicit. To explicitly cast an expression prefixthe expression with type name as shown in the code snippet below. Button mybtn = (Button) (myVector.elementAt(9)); In some situations JAVA runtime changes the type of an expression with out performinga cast. For instance in the below code snippet my inventory object is type casted andstored as type Object. myVectorSales.add(objInventory);
__________________ Venkat knowledge is Power |
|
#5
| |||
| |||
| hey guys, Why do we use collections when we had traditional ways forcollection? Before the collection framework JAVA provided ad hoc classes such as Dictionary, Vector,Stack and Properties to store and manipulate group of objects. Following are the mainreason why collection framework is more desirable than the traditional JAVA collectionobjects:- √Traditional objects did not have the unifying theme. The way you access VECTORis different from Properties. Due to this ADHOC approach software is not easilyextendable and adaptable. One of the unifying themes in the new JAVA collection isthe iterator interface. It gives a unifying way for looping through JAVA collections. √Ready made algorithms are one of the important features of the JAVA collection.Algorithms operate on collections and are defined as static methods within theCollections class. Thus, they are available for all collections. Each collection classneed not implement its own versions. The algorithms provide a standard means ofmanipulating collections. √Implementation of dynamic arrays, linked lists, trees, and hash tables are done inefficient manner. In case of traditional JAVA collection you will need to code allthese implementation by yourself.
__________________ Venkat knowledge is Power |
|
#6
| |||
| |||
| What is the difference between procedural and object-oriented programs? a) 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 and which in turn assures the security of the code. |
|
#7
| |||
| |||
| What are Encapsulation, Inheritance and Polymorphism? *Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse *Inheritance is the process by which one object acquires the properties of another object. * Polymorphism is the feature that allows one interface to be used for general class actions. |
|
#8
| |||
| |||
| What is the difference between Assignment and Initialization?- Assignment can be done as many times as desired whereas initialization can be done only once. |
|
#9
| |||
| |||
| What are Class, Constructor and Primitive data types? *Class is a template for multiple objects with similar features and it is a blue print for objects. It defines a type of object according to the data the object can hold and the operations the object can perform. *Constructor is a special kind of method that determines how an object is initialized when created. *Primitive data types are 8 types and they are: byte, short, int, long, float, double, boolean, char. |
|
#10
| |||
| |||
| What is an Object and how do you allocate memory to it? Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data. When an object is created using new operator, memory is allocated to it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Greetings from Java J2EE web development team | tenax_technologies | Introductions | 1 | 07-04-2009 11:53 PM |
| Asp Interview Questions | sureshbb | ASP and ASP.NET Programming | 35 | 10-29-2008 07:58 PM |
| CSS Interview Questions And Answers | Sabari | Interview Questions & Answers and Tips | 137 | 11-25-2007 08:38 PM |
| HR Interview Questions with Answers | Sabari | Interview Questions & Answers and Tips | 63 | 11-23-2007 05:13 AM |
| Interview Questions | shiva | Interview Questions & Answers and Tips | 6 | 08-24-2007 01:28 AM |
Our Partners |