Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. How could Java classes direct program messages to the system console, but
error messages, say to a file?
The class System has a variable out that represents the standard output, and the
variable err that represents the standard error device. By default, they both point
at the system console. This how the standard output could be re-directed:
Stream st =
new Stream (new
FileOutputStream ("techinterviews_com.txt"));
System.setErr(st);
System.setOut(st);
An abstract class may contain code in method bodies, which is not allowed in an
interface. With abstract classes, you have to inherit your class from it and Java
does not allow multiple inheritance. On the other hand, you can implement
multiple interfaces in your class.
Synchronized blocks place locks for shorter periods than synchronized methods.
This keyword indicates that the value of this member variable does not have to be
serialized with the object. When the class will be de-serialized, this variable will
be initialized with a default value of its data type (i.e. zero for integers).
You can’t force GC, but could request it by calling System.gc(). JVM does not
guarantee that GC will be started immediately.
If you assign a superclass object to a variable of a subclass’s data type, you need
to do explicit casting. For example:
When you assign a subclass to a variable having a supeclass type, the casting is
performed automatically.
7. What’s the difference between the methods sleep() and wait()
The code sleep(1000); puts thread aside for exactly one second. The code
wait(1000), causes a wait of up to one second. A thread could stop waiting earlier
if it receives the notify() or notifyAll() call. The method wait() is defined in the
class Object and the method sleep() is defined in the class Thread.
8. Can you write a Java class that could be used both as an applet as well as an
application?
Constructors must have the same name as the class and can not return a value.
They are only called once while regular methods could be called many times.
10. Can you call one constructor from another if a class has multiple
constructors
This is a way to organize files when a project consists of multiple modules. It also
helps resolve naming conflicts when different packages have classes with the
same names. Packages access level also allows you to protect data from being
used by the non-authorized classes.
You need to add a directory or a jar file that contains the package directories to the
CLASSPATH environment variable. Let’s say a class Employee belongs to a
package com.xyz.hr; and is located in the file c:/dev/com.xyz.hr.Employee.java.
In this case, you’d need to add c:/dev to the variable CLASSPATH. If this class
contains the method main(), you could test it from a command prompt window as
follows:
c:\>java com.xyz.hr.Employee
13. What’s the difference between J2SDK 1.5 and J2SDK 5.0?
14. What would you use to compare two String variables - the operator == or the
method equals()?
I’d use the method equals() to compare the values of the Strings and the = = to
check if two variables point at the same instance of a String object.
16. Can an inner class declared inside of a method access local variables of this
method?
17. What can go wrong if you replace && with & in the following code:
18.String a=null;
19.if (a!=null && a.length()>10)
{...}
This method is used to ensure that Swing components are updated through the
event-dispatching thread.
Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.
24. You can create an abstract class that contains only abstract methods. On the
other hand, you can create an interface that declares the same methods. So
can you use abstract classes instead of interfaces?
Sometimes. But your class may be a descendent of another class and in this case
the interface is your only option.
25. What comes to mind when you hear about a young generation in Java?
Garbage collection.
26. What comes to mind when someone mentions a shallow copy in Java?
Object cloning.
27. If you’re overriding the method equals() of an object, which other method
you might also consider?
hashCode()
28. You are planning to do an indexed search in a list of objects. Which of the
two Java collections should you use: ArrayList or LinkedList?
ArrayList
29. How would you make a copy of an entire Java object with its state?
Have this class implement Cloneable interface and call its method clone().
30. How can you minimize the need of garbage collection and make the memory
use more effective?
31. There are two classes: A and B. The class B need to inform a class A when
some important event has happened. What Java technique would you use to
implement it?
If these classes are threads I’d consider notify() or notifyAll(). For regular classes
you can use the Observer interface.
32. What access level do you need to specify in the class declaration to ensure
that only classes from the same directory can access it?
You do not need to specify any access level, and Java will use a default package
access level.
SQL Database interview questions
SQL
SQL is an English like language consisting of commands to store, retrieve, maintain &
regulate access to your database.
SQL*Plus
SQL*Plus is an application that recognizes & executes SQL commands & specialized
SQL*Plus commands that can customize reports, provide help & edit facility & maintain
system variables.
NVL
NVL : Null value function converts a null value to a non-null value for the purpose of
evaluating an expression. Numeric Functions accept numeric I/P & return numeric
values. They are MOD, SQRT, ROUND, TRUNC & POWER.
Date Functions
Date Functions are ADD_MONTHS, LAST_DAY, NEXT_DAY, MONTHS_BETWEEN
& SYSDATE.
Character Functions
Character Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional
functions are GREATEST & LEAST. Group Functions returns results based upon groups
of rows rather than one result per row, use group functions. They are AVG, COUNT,
MAX, MIN & SUM.
COLUMN
COLUMN command define column headings & format data values.
BREAK
BREAK command clarify reports by suppressing repeated values, skipping lines &
allowing for controlled break points.
COMPUTE
command control computations on subsets created by the BREAK command.
SET
SET command changes the system variables affecting the report environment.
SPOOL
SPOOL command creates a print file of the report.
JOIN
JOIN is the form of SELECT command that combines info from two or more tables.
Types of Joins are Simple (Equijoin & Non-Equijoin), Outer & Self join.
Equijoin returns rows from two or more tables joined together based upon a equality
condition in the WHERE clause.
Non-Equijoin returns rows from two or more tables based upon a relationship other than
the equality condition in the WHERE clause.
Outer Join combines two or more tables returning those rows from one table that have no
direct match in the other table.
Self Join joins a table to itself as though it were two separate tables.
Union
Union is the product of two or more tables.
Intersect
Intersect is the product of two tables listing only the matching rows.
Minus
Minus is the product of two tables listing only the non-matching rows.
Correlated Subquery
Correlated Subquery is a subquery that is evaluated once for each row processed by the
parent statement. Parent statement can be Select, Update or Delete. Use CRSQ to answer
multipart questions whose answer depends on the value in each row processed by parent
statement.
Multiple columns
Multiple columns can be returned from a Nested Subquery.
Sequences
Sequences are used for generating sequence numbers without any overhead of locking.
Drawback is that after generating a sequence number if the transaction is rolled back,
then that sequence number is lost.
Synonyms
Synonyms is the alias name for table, views, sequences & procedures and are created for
reasons of Security and Convenience.
Two levels are Public - created by DBA & accessible to all the users. Private - Accessible
to creator only. Advantages are referencing without specifying the owner and Flexibility
to customize a more meaningful naming convention.
Indexes
Indexes are optional structures associated with tables used to speed query execution
and/or guarantee uniqueness. Create an index if there are frequent retrieval of fewer than
10-15% of the rows in a large table and columns are referenced frequently in the WHERE
clause. Implied tradeoff is query speed vs. update speed. Oracle automatically update
indexes. Concatenated index max. is 16 columns.
Data types
Max. columns in a table is 255. Max. Char size is 255, Long is 64K & Number is 38
digits.
Cannot Query on a long column.
Char, Varchar2 Max. size is 2000 & default is 1 byte.
Number(p,s) p is precision range 1 to 38, s is scale -84 to 127.
Long Character data of variable length upto 2GB.
Date Range from Jan 4712 BC to Dec 4712 AD.
Raw Stores Binary data (Graphics Image & Digitized Sound). Max. is 255 bytes.
Mslabel Binary format of an OS label. Used primarily with Trusted Oracle.
Transaction
Transaction is defined as all changes made to the database between successive commits.
Commit
Commit is an event that attempts to make data in the database identical to the data in the
form. It involves writing or posting data to the database and committing data to the
database. Forms check the validity of the data in fields and records during a commit.
Validity check are uniqueness, consistency and db restrictions.
Posting
Posting is an event that writes Inserts, Updates & Deletes in the forms to the database but
not committing these transactions to the database.
Rollback
Rollback causes work in the current transaction to be undone.
Savepoint
Savepoint is a point within a particular transaction to which you may rollback without
rolling back the entire transaction.
Set Transaction
Set Transaction is to establish properties for the current transaction.
Locking
Locking are mechanisms intended to prevent destructive interaction between users
accessing data. Locks are used to achieve.
Consistency
Consistency : Assures users that the data they are changing or viewing is not changed
until the are thro’ with it.
Integrity
Assures database data and structures reflects all changes made to them in the correct
sequence. Locks ensure data integrity and maximum concurrent access to data. Commit
statement releases all locks. Types of locks are given below.
Data Locks protects data i.e. Table or Row lock.
Dictionary Locks protects the structure of database object i.e. ensures table’s structure
does not change for the duration of the transaction.
Internal Locks & Latches protects the internal database structures. They are automatic.
Exclusive Lock allows queries on locked table but no other activity is allowed.
Share Lock allows concurrent queries but prohibits updates to the locked tables.
Row Share allows concurrent access to the locked table but prohibits for a exclusive table
lock.
Row Exclusive same as Row Share but prohibits locking in shared mode.
Shared Row Exclusive locks the whole table and allows users to look at rows in the table
but prohibit others from locking the table in share or updating them.
Share Update are synonymous with Row Share.
Deadlock
Deadlock is a unique situation in a multi user system that causes two or more users to
wait indefinitely for a locked resource. First user needs a resource locked by the second
user and the second user needs a resource locked by the first user. To avoid dead locks,
avoid using exclusive table lock and if using, use it in the same sequence and use Commit
frequently to release locks.
Mutating Table
Mutating Table is a table that is currently being modified by an Insert, Update or Delete
statement. Constraining Table is a table that a triggering statement might need to read
either directly for a SQL statement or indirectly for a declarative Referential Integrity
constraints. Pseudo Columns behaves like a column in a table but are not actually stored
in the table. E.g. Currval, Nextval, Rowid, Rownum, Level etc.
SQL*Loader
SQL*Loader is a product for moving data in external files into tables in an Oracle
database. To load data from external files into an Oracle database, two types of input
must be provided to SQL*Loader : the data itself and the control file. The control file
describes the data to be loaded. It describes the Names and format of the data files,
Specifications for loading data and the Data to be loaded (optional). Invoking the loader
sqlload username/password controlfilename.
HR Questions
1. What is more important to you: the money or the work? Subscribe
Money is always important, but the work is the most important. There is no better answer.
Latest Answer: I think Money is more important than Work, All are satisfied when get
More Money for Less work, But...
Last Updated By Prasad on June 23, 2007 (Answers: 12) Read / Answer
2. What would your previous supervisor say your strongest point is? Subscribe
There are numerous good possibilities: Loyalty, Energy, Positive attitude, Leadership,
Team player, Expertise, Initiative, Patience, Hard work, Creativity, Problem solver
Latest Answer: Dedication: willingness to go the extra mile to achieve excellence...
Last Updated By Riya on August 25, 2006 (Answers: 2) Read / Answer
3. Tell me about a problem you had with a supervisor? Subscribe
Biggest trap of all. This is a test to see if you will speak ill of your boss. If you fall for it
and tell about a problem with a former boss, you may well below the interview right
there. Stay positi
Latest Answer: Hi,To add up a little humour, sayActually, it was he who was having
problem's. I was just constantly...
Last Updated By Bhaskar on April 25, 2006 (Answers: 2) Read / Answer
4. What has disappointed you about a job? Subscribe
Don't get trivial or negative. Safe areas are few but can include: Not enough of a
challenge. You were laid off in a reduction Company did not win a contract, which would
have given you more responsib
Read / Answer
5. Tell me about your ability to work under pressure? Subscribe
You may say that you thrive under certain types of pressure. Give an example that relates
to the type of position applied for.
Latest Answer: It is one's personal tolerence power to handle the tens condition. To solve
it or say handle it,you ...
Last Updated By ganju on June 08, 2007 (Answers: 5) Read / Answer
6. Do your skills match this job or another job more closely? Subscribe
Probably this one. Do not give fuel to the suspicion that you may want another job more
than this one.
Latest Answer: I would try to utilise my skills according to the job given to me......
Last Updated By kana on April 12, 2006 (Answers: 1) Read / Answer
7. What motivates you to do your best on the job? Subscribe
This is a personal trait that only you can say, but good examples are: Challenge,
Achievement, Recognition
Latest Answer: perfection,confidence,patience are the thing me to motivate on the job...
Last Updated By karthick on May 12, 2006 (Answers: 3) Read / Answer
8. Are you willing to work overtime? Nights? Weekends? Subscribe
This is up to you. Be totally honest. How would you know you were successful on this
job?
Latest Answer: If the project deadlined demand then yes. Do not show that its your
culture to work overnights....
Last Updated By Rahul on January 14,
(Answers: 2) Read / Answer
2007
9. Would you be willing to relocate if required? Subscribe
You should be clear on this with your family prior to the interview if you think there is a
chance it may come up. Do not say yes just to get the job if the real answer is no. This can
create a lot o
Latest Answer: yes of course....i would like to work in a different environment and after
a couple of years i'l...
Last Updated By karthic on July 05, 2007 (Answers: 3) Read / Answer
10. Are you willing to put the interests of the organization ahead of Subscribe
your own?
This is a straight loyalty and dedication question. Do not worry about the deep ethical and
philosophical implications. Just say yes.
Latest Answer: : Yes, but in return I would expect the organization to take care of my
needs as an individual...
Last Updated By Deepali on January 25,
(Answers: 1) Read / Answer
2007
ORACLE Questions
RE: Which one is faster DELETE/TRUNCATE? Why?
Truncate table
------------------
1) Truncate table is DDL and can be run by the owner of the table.
2) Can't Rollback the truncate table command.
3) It release the space and re-set the high water mark in the segment.
4) Selective record deletion is not possible with truncate table . i.e you can not
specifiy where condition in truncate table command.
Delete
--------
1) User with delete permission can delete records from the table.
2) Delete can be rollback.
3) Does not release the occupied space in the segment.
4) We can specifiy selective record deletion in delete i.e. delete from <table_name>
where <condition>
2. Incremental level backup using export and import is not there in Oracle 9i
3. Lot of simplified scripts for RMAN backup and Recovery when compared to Oracle 8i
: what is the difference between primary key, unique key, sorrougate key?
Primary Key: A column in a table whose values uniquely identify the rows in the
table. A primary key value cannot be NULL.
Unique Key: Unique Keys are used to uniquely identify each row in an Oracle table.
There can be one and only one row for each unique key value.
Surrogate Key: A system generated key with no business value. Usually implemented
with database generated sequences.
----------- ------------------
Oracle database usually contains one database and a single instance. But, Oracle 9i,
10g RAC (Real Application Clusters) can have multiple instances to interact with a single
database for high availability.
The process of separating data into distinct, unique sets is called normalization. This
is implemented to imorove the performance of the RDBMS, such as reduceces
redunbdancy of data and data inconsistency.
Normalization is the process of removing redundant data from your tables in order to
improve storage efficiency, data integrity and scalability
Normalization is the process used to reduce the unnecessary repetetion of data i.e,
redundant data.It is performed on the data which is redundant and makes the data in a
normalized format.It is of step-by-step processIstNotmal FormIIndNormal
formIIIrdNormalformIVth Normalform or BoyceCodd Normal formBy perofmring
this we will get the data in the Normalized formati.,e from DBMS to RDBMS.
Do not use multiple fields in a single table to store similar data. For example, to track an
inventory item that may come from two possible sources, an inventory record may
contain fields for Vendor Code 1 and Vendor Code 2.
But what happens when you add a third vendor? Adding a field is not the answer; it
requires program and table modifications and does not smoothly accommodate a dynamic
number of vendors. Instead, place all vendor information in a separate table called
Vendors, then link inventory to vendors with an item number key, or vendors to inventory
with a vendor code key.
• Create separate tables for sets of values that apply to multiple records.
• Relate these tables with a foreign key.
Records should not depend on anything other than a table's primary key (a compound
key, if necessary). For example, consider a customer's address in an accounting system.
The address is needed by the Customers table, but also by the Orders, Shipping, Invoices,
Accounts Receivable, and Collections tables. Instead of storing the customer's address as
a separate entry in each of these tables, store it in one place, either in the Customers table
or in a separate Addresses table.
Values in a record that are not part of that record's key do not belong in the table. In
general, any time the contents of a group of fields may apply to more than a single record
in the table, consider placing those fields in a separate table.
For example, in an Employee Recruitment table, a candidate's university name and
address may be included. But you need a complete list of universities for group mailings.
If university information is stored in the Candidates table, there is no way to list
universities with no current candidates. Create a separate Universities table and link it to
the Candidates table with a university code key.
EXCEPTION: Adhering to the third normal form, while theoretically desirable, is not
always practical. If you have a Customers table and you want to eliminate all possible
interfield dependencies, you must create separate tables for cities, ZIP codes, sales
representatives, customer classes, and any other factor that may be duplicated in multiple
records. In theory, normalization is worth pursuing; however, many small tables may
degrade performance or exceed open file and memory capacities.
It may be more feasible to apply third normal form only to data that changes frequently.
If some dependent fields remain, design your application to require the user to verify all
related fields when any one is changed.
Fourth normal form, also called Boyce Codd Normal Form (BCNF), and fifth normal
form do exist, but are rarely considered in practical design. Disregarding these rules may
result in less than perfect database design, but should not affect functionality.
**********************************
Examples of Normalized Tables
********************************** Normalization Examples: Unnormalized
table: Student# Advisor Adv-Room Class1 Class2 Class3
------------------------------------------------------- 1022
Jones 412 101-07 143-01 159-02 4123 Smith
216 201-01 211-02 214-01
The mejor defference between varchar2 and char is fixed length and variable length .
varchar2 have varible length mean if we declare as 20 space and its use only 5 space the
memory asigne only 5 . but in char takes daclare space while use any number space less
than declare .
char is used if we know that the length wont exceed the specified range while varchar is
used for varying range.
If we want any string not exceeding 6, we use char(6),because we can put a constraint if
someone is trying to enter more or less than 6.
When we export external data then we used fixed lenght of record this is possible by char
or second reson is whenever we use varchar it stores its width which occupies memory.
so here two reson is sufficient for char.
char is of fied length search operation becomes faster since oracle engine has to look for
predetermined length of characters.
Constraints are used to maintain the integrity and atomicity of database .in other words
it can be said they are used to prevent invalid data entry . the main 5 constraints are
NOT NULL,PRIMARY KEY,FOREIGN KEY,UNIQUE KEY and CHECK
Triggers are bascically stored procedures which automaticallly fired when any
insert,update or delete is issued on table.
Another most imp. deff. is that trigger effected only those row after which trigger applied
but constraint effected all row of table .
Triggers are used to carry out tasks which cant be done using constraints.
For eg:-A change in the "sal" column of a table should change the "tax" column in
another table.This cant be done using constraints.It has to be done using triggers.Thats
where the importance of triggers lie.
The NULL in C treated as Zero or void. but in SQL NULL value is Non or blank
represented it can't manuplated.
NULL in SQL in an unknown value. It neither zero nor any valid value. It cannot be
mapulated, but it can only be compared.
With reference from the Oracle book,NULL is a undetermined value and will lead to
infinite process (loop). NULL must be handled carefully to avoid ambiguity.To
understand the difference, ZERO is a numeric value and BLANK is a special
character.All the best!!!
Varchar and Varchar2 are both same except for varchar2 supports upto 2000 char
Both varchar and varchar2 are same which is of variable length characters but
in varchar maximum chars are 2000 and in later one is 4000 bytes.
Both Replace and Translate are single row functions in Oracle 9i.
But in Translate Function replaces sinlge character with sinlge character only.
what is the difference between rownum,rowid
rowid has a physical significance i.e you can read a row if you know rowid. It is complete
physical address of a row.
While rownum is temporary serial number allocated to each returned row during query
execution.
Cold Backup- We can take the Backup while DB(eg. Oracle) is down.
Hot Backup-We can take the Backup while DB(eg. Oracle) is running.
Cold backup is a physical backup. During a cold backup the database is closed and
not available to users. All files of the database are copied (image copy). The
datafiles do not change during the copy so the database is in sync upon restore.
Used when:Service level allows for some down time for backup
Hot backup is a physical backup. In a hot backup the database remains open and
available to users. All files of the database are copied (image copy). There may be
changes to the database as the copy is made and so all log files of changes being
made during the backup must be saved too. Upon a restore, the changes in the log
files are reapplied to bring the database in sync. Used when:A full backup of a
database is needed
Service level allows no down time for the backup.
JAVA Questions
How to define an Abstract class?
Answer: A class containing abstract method is called Abstract class. An Abstract class
can't be instantiated.
Example of Abstract class:
abstract class testAbstractClass {
protected String myString;
public String getMyString() {
return myString;
}
public abstract string anyAbstractFunction();
}
• Scrollable result sets- using new methods in the ResultSet interface allows
programmatically move the to particular row or to a position relative to its current
position
• JDBC 2.0 Core API provides the Batch Updates functionality to the java
applications.
• Java applications can now use the ResultSet.updateXXX methods.
• New data types - interfaces mapping the SQL3 data types
• Custom mapping of user-defined types (UTDs)
• Miscellaneous features, including performance hints, the use of character streams,
full precision for java.math.BigDecimal values, additional security, and support
for time zones in date, time, and timestamp values.
• Method overloading
• Method overriding through inheritance
• Method overriding through the Java interface
• Public
• Protected
• Private
• Defaults
A session bean is similar to an interactive session and is not shared; it can have only one
client, in the same way that an interactive session can have only one user. A session bean
is not persistent and it is destroyed once the session terminates.
Entity Bean: An entity bean represents persistent global data from the database. Entity
beans data are stored into database.
What are types of J2EE clients?
Answer: J2EE clients are the software that access the services components installed on
the J2EE container. Following are the J2EE clients:
a) Applets
b) Java-Web Start clients
c) Wireless clients
d) Web applications
hat is a platform?
Answer: A platform is the hardware or software environment in which a program runs.
Most platforms can be described as a combination of the operating system and hardware,
like Windows 2000/XP, Linux, Solaris, and MacOS.
Question: How does multithreading take place on a computer with a single CPU?
Answer: The operating system's task scheduler allocates execution time to multiple tasks.
By quickly switching between executing tasks, it creates the impression that tasks
execute sequentially.
Question: Can Java object be locked down for exclusive use by a given thread?
Answer: Yes. You can lock an object by putting it in a "synchronized" block. The locked
object is inaccessible to any thread other than the one that explicitly claimed it
Question: Can each Java object keep track of all the threads that want to exclusively
access to it?
Answer: Yes
Question: What state does a thread enter when it terminates its processing?
Answer: When a thread terminates its processing, it enters the dead state.
Question: What is the purpose of the wait(), notify(), and notifyAll() methods?
Answer: The wait(),notify(), and notifyAll() methods are used to provide an efficient
way for threads to communicate each other.
Is sizeof a keyword?
Answer: The sizeof operator is not a keyword.
Question: What is the difference between the Boolean & operator and the && operator?
Answer: 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 operands. If the first operand evaluates to false, the
evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked
why, give details as above.
What is the purpose of the System class?
Answer:The purpose of the System class is to provide access to system resources.
Question: What is the difference between a static and a non-static inner class?
Answer: A non-static inner class may have object instances that are associated with
instances of the class's outer class. A static inner class does not have any object instances.
Question: If a class is declared without any access modifiers, where may the class be
accessed?
Answer: A class that is declared without any access modifiers is said to have package or
friendly access. This means that the class can only be accessed by other classes and
interfaces that are defined within the same package.
Question: What is the difference between the paint() and repaint() methods?
Answer: The paint() method supports painting via a Graphics object. The repaint()
method is used to cause paint() to be invoked by the AWT painting thread.
What is polymorphism?
Answer: Polymorphism allows methods to be written that needn't be concerned about the
specifics of the objects they will be applied to. That is, the method can be specified at a
higher level of abstraction and can be counted on to work even on objects of yet
unconceived classes.
o interface contains methods that must be abstract; abstract class may contain concrete
methods.
o interface contains variables that must be static and final; abstract class may contain
non-final and final variables.
o members in an interface are public by default, abstract class may contain non-public
members.
o interface can be used to achieve multiple inheritance; abstract class can be used as a
single inheritance.
o interface can "extends" another interface, abstract class can "extends" another class and
"implements" multiple interfaces.
o interface is more flexible than abstract class because one class can only "extends" one
super class, but "implements" multiple interfaces.
A variable can be made constant only with the help of a final keyword. If you want to
make it to be accessible from other classes then you need static.
What are the different kinds of exceptions? How do you catch a Runtime exception
Checked exception is catched at the compile time while unchecked exception is checked
at run time.
Hi,
Enterprise Java bean is a server side component.
it contains business logic and no system level programming and services like
transactions,threading,persistence and security as EJB server provide all these for EJB
component.
EJB component is inherently transactional,scalable and secure.
it is wire-protocol neutral,any protocol can be used like IIOP,HTTP etc.
it means transferring object in to the byte form for maintaing persistance within object.
restoring the object is done by deseralization.
AWT - Heavy weight component. Every graphical units it will invoke native methods.
SWING - Light weight component. It doesn't invoke native methods.
hi
the main difference is Ejb componenets are distributed which means develop once and
run anywhere.
java beans are not distributed. which means the beans cannot be shared .
JSP Lifecycle:
Instantiate and loading Phase: Instance will be created for the servlet ands it will be
loaded to memory.
Call jspinit():Perform Initialization process.
Call jspDestroy(): the instance will be destroyed when not needed any more.
Call service(): this will be called upon each request which in turn calls doXXX()
methods.
native:when you want to get functionality from particular language like c/c++ native is
used
volatile : is an indication to the compiler that the value may be changed by the program
some where else
final: can be used for variable,method and for class. final variables acts as constant. final
methods can not be overridden. final class can not have sub class.
HashList is a data structure storing objects in a hash table and a list.it is a combination of
hashmap and doubly linked list. acess will be faster. HashMap is hash table
implementation of map interface it is same as HashTable except that it is unsynchronized
and allow null values. List is an ordered collection and it allow nulls and duplicates in
it. positional acess is possible. Set is a collection that
doesn't allow duplicates, it may allow at most one null element. same as our
mathematical set.
hi,
encapsulation mean data hiding.data correspond to varibles and methods of the class.
Data hiding mean: when u make different objects of the same class. The data stored in
one object is unaware of the data for other object of the same class. In, this way it gives
secure data.
Note: Methods in Vector are synchronised which means they are thread-safe and thus
preclude access to the Vector elements by concurrent threads.Bu this imposes additional
overhead on the JVM as it has to acquire and release locks on the vector objects under
consideration.
This is not possible in ArrayList since those methods are not synchronised and hence are
faster in performance.
Use Vector only if it will be accessed by multiple threads at a time else ArrayList is
always better.
In ArrayList we can store similar data types
but in Vectror we can store different types of data.
class a{
String s;
a(){
s="hi";
now
create objectoutputstream object and give it to fileoutputstream with file name say "a.ser"
(use writeObject() method)
now create object Inputstream object and give it to fileinputstream with file same name
"a.ser"(use readObject() method)
chow.
String vijay=request.getParameter("vijay");
HttpSesssion hs=request.getSession("true");
then call
hs.setAttribute("sessionobject",vijay);
we call as
String name=(String)request.getAttribute("sessionobject");
out.println("name");
Session tracking is a mechanism that servlets use to maintain state about a series of
requests from the same user (that is, requests originating from the same browser) across
some period of time.
Sessions are shared among the servlets accessed by a client. This is convenient for
applications made up of multiple servlets. For example, Duke's Bookstore uses session