Вы находитесь на странице: 1из 4

1- How do you se t security in applets?

- using setSecurityManager() method 2- What is an event and what are the models available for event handling? - An event is an event object that describes a state of change in a source. In other words, event occurs when an action is generated, li e !ressing button, clic ing mouse, selecting a list, etc. "here are two ty!es of models for handling events and they are# a) event-inheritance model and b) event-delegation model 3- What are the advantages of the model over the event-inheritance model? - "he event-delegation model has two advantages over the event-inheritance model. "hey are# a)It enables event handling by objects other than the ones that generate the events. "his allows a clean se!aration between a com!onent$s design and its use. b)It !erforms much better in a!!lications where many events are generated. "his !erformance im!rovement is due to the fact that the event-delegation model does not have to be re!eatedly !rocess unhandled events as is the case of the event-inheritance. 4- What is source and listener? - source # A source is an object that generates an event. "his occurs when the internal state of that object changes in some way. listener # A listener is an object that is notified when an event occurs. It has two major re%uirements. &irst, it must have been registered with one or more sources to receive notifications about s!ecific ty!es of events. Second, it must im!lement methods to receive and !rocess these notifications. 5- What is adapter class? - An ada!ter class !rovides an em!ty im!lementation of all methods in an event listener interface. Ada!ter classes are useful when you want to receive and !rocess only some of the events that are handled by a !articular event listener interface. 'ou can define a new class to act listener by e(tending one of the ada!ter classes and im!lementing only those events in which you are interested. &or e(am!le, the MouseMotionAda!ter class has two methods, mouse)ragged()and mouseMoved(). "he signatures of these em!ty are e(actly as defined in the MouseMotion*istener interface. If you are interested in only mouse drag events, then you could sim!ly e(tend MouseMotionAda!ter and im!lement mouse)ragged() . - What is meant by controls and what are different types of controls in !W"? - +ontrols are com!onents that allow a user to interact with your a!!lication and the A," su!!orts the following ty!es of controls# *abels, -ush .uttons, +hec .o(es, +hoice *ists, *ists, Scrollbars, "e(t +om!onents. "hese controls are subclasses of +om!onent. #- What is the difference between choice and list? - A +hoice is dis!layed in a com!act form that re%uires you to !ull it down to see the list of available choices and only one item may be selected from a choice. A *ist may be dis!layed in such a way that several list items are visible and it su!!orts the selection of one or more list items. $- What is the difference between scrollbar and scrollpane? - A Scrollbar is a +om!onent, but not a +ontainer whereas Scroll!ane is a +onatiner and handles its own events and !erform its own scrolling. %- What is a layout manager and what are different types of layout managers available in &ava !W"?

- A layout manager is an object that is used to organi/e com!onents in a container. "he different layouts are available are &low*ayout, .order*ayout, +ard*ayout, 0rid*ayout and 0rid.ag*ayout. 1'- How are the elements of different layouts organi(ed? - &low*ayout# "he elements of a &low*ayout are organi/ed in a to! to bottom, left to right fashion. .order*ayout# "he elements of a .order*ayout are organi/ed at the borders (1orth, South, 2ast and ,est) and the center of a container. +ard*ayout# "he elements of a +ard*ayout are stac ed, on to! of the other, li e a dec of cards. 0rid*ayout# "he elements of a 0rid*ayout are of e%ual si/e and are laid out using the s%uare of a grid. 0rid.ag*ayout# "he elements of a 0rid.ag*ayout are organi/ed according to a grid. 3owever, the elements are of different si/e and may occu!y more than one row or column of the grid. In addition, the rows and columns may have different si/es. 11- Which containers use a )order layout as their default layout? - ,indow, &rame and )ialog classes use a .order*ayout as their layout. 12- Which containers use a *low layout as their default layout? - -anel and A!!let classes use the &low*ayout as their default layout. 13- What are wrapper classes? - ,ra!!er classes are classes that allow !rimitive ty!es to be accessed as objects. 14- What are +ector, Hashtable, -in.ed-ist and /numeration? - 4ector # "he 4ector class !rovides the ca!ability to im!lement a growable array of objects. 3ashtable # "he 3ashtable class im!lements a 3ashtable data structure. A 3ashtable inde(es and stores objects in a dictionary using hash codes as the object$s eys. 3ash codes are integer values that identify objects. *in ed*ist# 5emoving or inserting elements in the middle of an array can be done using *in ed*ist. A *in ed*ist stores each object in a se!arate lin whereas an array stores object references in consecutive locations. 2numeration# An object that im!lements the 2numeration interface generates a series of elements, one at a time. It has two methods, namely hasMore2lements() and ne(t2lement(). 3asMore2lemnts() tests if this enumeration has more elements and ne(t2lement method returns successive elements of the series. 15- What is the difference between set and list? - Set stores elements in an unordered way but does not contain du!licate elements, whereas list stores elements in an ordered way but may contain du!licate elements. 1 - What is a stream and what are the types of 0treams and classes of the 0treams? - A Stream is an abstraction that either !roduces or consumes information. "here are two ty!es of Streams and they are# .yte Streams# -rovide a convenient means for handling in!ut and out!ut of bytes. +haracter Streams# -rovide a convenient means for handling in!ut 6 out!ut of characters. .yte Streams classes# Are defined by using two abstract classes, namely In!utStream and 7ut!utStream. +haracter Streams classes# Are defined by using two abstract classes, namely 5eader and ,riter. 1#- What is the difference between 1eader2Writer and 3nput0tream24utput 0tream? - "he 5eader8,riter class is character-oriented and the In!utStream87ut!utStream class is byte-oriented. 1$- What is an 324 filter?

- An I87 filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is !assed from one stream to another. 1%- What is seriali(ation and deseriali(ation? - Seriali/ation is the !rocess of writing the state of an object to a byte stream. )eseriali/ation is the !rocess of restoring these objects. 2'- What is 56)7? - 9).+ is a set of 9ava A-I for e(ecuting S:* statements. "his A-I consists of a set of classes and interfaces to enable !rograms to write !ure 9ava )atabase a!!lications. 21- What are drivers available? - a) 9).+-7).+ .ridge driver b) 1ative A-I -artly-9ava driver c) 9).+-1et -ure 9ava driver d) 1ative--rotocol -ure 9ava driver 22- What is the difference between 56)7 and 46)7? - a) 7.)+ is for Microsoft and 9).+ is for 9ava a!!lications. b) 7).+ can$t be directly used with 9ava because it uses a + interface. c) 7).+ ma es use of !ointers which have been removed totally from 9ava. d) 7).+ mi(es sim!le and advanced features together and has com!le( o!tions for sim!le %ueries. .ut 9).+ is designed to ee! things sim!le while allowing advanced ca!abilities when re%uired. e) 7).+ re%uires manual installation of the 7).+ driver manager and driver on all client machines. 9).+ drivers are written in 9ava and 9).+ code is automatically installable, secure, and !ortable on all !latforms. f) 9).+ A-I is a natural 9ava interface and is built on 7).+. 9).+ retains some of the basic features of 7).+. 23- What are the types of 56)7 6river 8odels and e9plain them? - "here are two ty!es of 9).+ )river Models and they are# a) "wo tier model and b) "hree tier model "wo tier model# In this model, 9ava a!!lications interact directly with the database. A 9).+ driver is re%uired to communicate with the !articular database management system that is being accessed. S:* statements are sent to the database and the results are given to user. "his model is referred to as client8server configuration where user is the client and the machine that has the database is called as the server. "hree tier model# A middle tier is introduced in this model. "he functions of this model are# a) +ollection of S:* statements from the client and handing it over to the database, b) 5eceiving results from database to the client and c) Maintaining control over accessing and u!dating of the above. 24- What are the steps involved for ma.ing a connection with a database or how do you connect to a database? a) *oading the driver # "o load the driver, +lass. for1ame() method is used. +lass. for1ame(;sun. jdbc. odbc. 9dbc7dbc)river;)< ,hen the driver is loaded, it registers itself with the java. s%l. )riverManager class as an available database driver. b) Ma ing a connection with database# "o o!en a connection to a given database, )riverManager. get+onnection() method is used. +onnection con = )riverManager. get+onnection (;jdbc#odbc#somedb;, >user;, >!assword;)< c) 2(ecuting S:* statements # "o e(ecute a S:* %uery, java. s%l. statements class is used. createStatement() method of +onnection to obtain a new Statement object. Statement stmt = con. createStatement()< A %uery that returns data can be e(ecuted using the e(ecute:uery() method of Statement. "his method e(ecutes the statement and returns a java. s%l. 5esultSet that enca!sulates the retrieved data# 5esultSet rs = stmt. e(ecute:uery(;S2*2+" ? &57M some table;)< d) -rocess the results # 5esultSet returns one row at a time. 1e(t() method of 5esultSet object can be called to move to the ne(t row. "he getString() and get7bject() methods are used for retrieving column values# while(rs. ne(t()) @ String event = rs. getString(;event;)< 7bject count = (Integer) rs. get7bject(;count;)< 25- What type of driver did you use in pro&ect?

- 9).+-7).+ .ridge driver (is a driver that uses native(+ language) libraries and ma es calls to an e(isting 7).+ driver to access a database engine

Вам также может понравиться