Vous êtes sur la page 1sur 19

S K R ENGINEERING COLLEGE

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CS2305 PROGRAMMING PARADIGMS


2 MARKS

Created By
1

S. Saranya Devi

UNIT I
1. What is Programming Paradigm?

The word paradigm to mean any example or model. Object-oriented programming paradigm suggests new ways of thinking for finding a solution to a problem. Hence the programmers should keep their mind tuned in such a manner that they are not to be blocked by their preconceptions experienced in other programming languages such as structured programming. Proficiency in object-oriented programming requires talent, creativity, intelligence, logical thinking and the ability to build and use abstractions and experience.
2. What is Object Oriented Programming?

Object-Orientation is a set of tools and methods that enable software engineers to build reliable, user friendly, maintainable, well documented, reusable software systems that fulfills the requirements of its users.
3. What are important features in object-oriented programming and design?

Improvement over the structured programming paradigm. Emphasis on data rather than algorithms. Procedural abstraction is complemented by data abstraction. Data and associated operations are unified, grouping objects with common attributes, operations and semantics.

4. What is an object?

An Object is anything having crisply defined conceptual boundaries. Book, pen, train, employee, student, machine, etc., are examples of objects.
5. What is a class?

Class is a data type. It generates object. It is the prototype or model. It does not occupy memory location. It cannot be manipulated because it is not available in the memory.
6. What are the fundamental features of object-oriented programming?

Encapsulation Data Abstraction Inheritance Polymorphism Extensibility Persistence Delegation Genericity Object Concurrency 2

Event Handling Multiple Inheritance Message Passing

7. What is Encapsulation?

The process, or mechanism, by which you combine code and the data it manipulates into a single unit, is commonly referred to as encapsulation. Encapsulation provides a layer of security around manipulated data, protecting it from external interference and misuse.
8. What is a Type?

A type is a set of values together with one or more operations that can be applied uniformly to all these values.
9. What is a class Members?

The non-static members of a class (variables and methods) are also known as instance variables and methods while the non-static members are also known as class variables and class methods.
10. What is meant by Access Specifiers?

The purpose of access specifiers is to declare which entity cannot be accessed from where. Its effect has different consequences when used on a class, class member (variable or method), constructor.
11. Explain the Static Class Method.

Static methods typically take all they data from parameters and compute something from those parameters, with no reference to variables. This is typical of methods which do some kind of generic calculation. A good example of this are the many utility methods in the predefined Math class.
12. Explain the accessing of static call method.

A common use of static variables is to define "constants". Examples from the Java library are Math.PI or Color.RED. They are qualified with the class name, so you know they are static. Any method, static or not, can access static variables. Instance variables can be accessed only by instance methods.
13. Explain the Constructor method in Java.

When you create a new instance (a new object) of a class using the new keyword, a constructor for that class is called. Constructors are used to initialize the instance variables (fields) of an object.
14. How to Write a Finalize method using Java.

Before an object is garbage collected, the runtime system calls its finalize() method. The intent is for finalize() to release system resources such as open files or open sockets before getting collected. Your class can provide 3

for its finalization simply by defining and implementing a method in your class named finalize(). Your finalize() method must be declared as follows: protected void finalize () throws throwable
15. What is an array? How to declare an array in java.

Array is the most important thing in any programming language. By definition, array is the static memory allocation. It allocates the memory for the same data type in sequence. It contains multiple values of same types. It also store the values in memory at the fixed size. Multiple types of arrays are used in any programming language such as: one - dimensional, two - dimensional or can say multi - dimensional. Declaration of an array: int num[]; or int num = new int[2];
16. What is the use of Strings in Java?

The String class is commonly used for holding and manipulating strings of text in Java programs. It is found in the standard java.lang package which is automatically imported, so you don't need to do anything special to use it.
17. Explain about String Tokenizer?

StringTokenizer class objects may be created by one of three constructor methods depending on the parameters used. The first parameter string is the source text to be broken at the default set of whitespace delimiters (space, tab, newline, cr, formfeed).
18. Explain the Java Packages.

A package is a grouping of related types providing access protection and name space management. Note that types refer to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces.
19. What is JavaDoc?

Javadoc is a convenient, standard way to document your Java code. Javadoc is actually a special format of comments. There are some utilities that read the comments, and then generate HTML document based on the comments. HTML files give us the convenience of hyperlinks from one document to another. Most class libraries, both commercial and open source, provide Javadoc documents.
20. Mention the types of the JavaDoc.

There are two kinds of Javadoc comments: class-level comments, and member-level comments. Class-level comments provide the description of the classes, and member-level comments describe the purposes of the members. UNIT - II
21. What Is Inheritance?

Inheritance can be defined as the process where one object acquires the properties of another. With the use of inheritance the information is made 4

manageable in a hierarchical order. When we talk about inheritance the most commonly used key words would be extends and implements. These words would determine whether one object IS-A type of another. By using these keywords we can make one object acquire the properties of another object.
22. Explain the concept of Polymorphism.

Polymorphism means when an entity behaves differently depending upon the context its being used. Moreover In other words Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. Means polymorphism allows you define one interface and have multiple implementations. That being one of the basic principles of object oriented programming.
23. Explain about Virtual methods.

A child class can override a method in its parent. An overridden method is essentially hidden in the parent class, and is not invoked unless the child class uses the super keyword within the overriding method.
24. What is Static Binding?

Connecting a method call(i.e. Function Call) to a method body(i.e. Function) is called binding. When binding is performed before the program is run (by the compiler and linker, if there is one), its called early binding or static Binding.
25. What is Dynamic binding?

The runtime system [JVM]during runtime determines the appropriate method call based on the class of the object. This feature is called as Polymorphism. All the methods in java are dynamically resolved. This cannot be determined by the Compiler.
26. What is an Abstract classes and Methods?

An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this: abstract void moveTo(double deltaX, double deltaY); If a class includes abstract methods, the class itself must be declared abstract, as in: public abstract class GraphicObject { // declare fields // declare non-abstract methods abstract void draw(); } When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, the subclass must also be declared abstract.
27. With example Explain Abstract Classes?

First, you declare an abstract class, GraphicObject, to provide member variables and methods that are wholly shared by all subclasses, such as the current position and the moveTo method. GraphicObject also declares abstract methods for methods, such as draw or resize, that need to be implemented by all subclasses but must be implemented in different ways.
28. When an Abstract Class Implements an Interface?

It was noted that a class that implements an interface must implement all of the interface's methods. It is possible, however, to define a class that does not implement all of the interface methods, provided that the class is declared to be abstract. For example, abstract class X implements Y { // implements all but one method of Y } class XX extends X { // implements the remaining method in Y } In this case, class X must be abstract because it does not fully implement Y, but class XX does, in fact, implement Y.
29. What is Object Class?

The Object class defines the basic state and behavior that all objects must have, such as the ability to compare oneself to another object, to convert to a string, to wait on a condition variable, to notify other objects that a condition variable has changed, and to return the object's class. 30. What Are Interfaces? An interface is a collection of method definitions (without implementations) and constant values. In Java, an interface is a reference data type and, as such, can be used in many of the same places where a type can be used (such as in method arguments and variable declarations)
31. What are the uses of Interfaces? Capturing similarities between unrelated classes without forcing a class

relationship. Declaring methods that one or more classes are expected to implement. Revealing an object's programming interface without revealing its class. (Objects such as these are called anonymous objects and can be useful when shipping a package of classes to other developers.)

32. Why Interfaces Do not Provide Multiple Inheritances? You cannot inherit variables from an interface. You cannot inherit method implementations from an interface. The interface hierarchy is independent of a class hierarchy--classes that

implement the same interface may or may not be related through the class hierarchy. This is not true for multiple inheritances. 6

33. Explain about the Java Packages?

Several packages of reusable classes are shipped as part of the Java development environment. Indeed, you have already encountered several classes that are members of these packages: String, System, and Date, to name a few. The classes and interfaces contained in the Java packages implement various functions ranging from networking and security to graphical user interface elements.
34. Explain about Java I/O Package?

The Java I/O Package (java.io) provides a set of input and output streams used to read and write data to files or other input and output sources. The classes and interfaces defined in java.io are covered fully in Input and Output Streams.
35. Explain about Java Utility Package?

This Java package, java.util, contains a collection of utility classes. Among them are several generic data structures (Dictionary, Stack, Vector, Hashtable) a useful object for tokenizing a string and another for manipulating calendar dates. The java.util package also contains the Observer interface and Observable class, which allow objects to notify one another when they change. The java.util classes aren't covered separately in this tutorial although some examples use these classes.
36. Explain about Applet Package?

This package contains the Applet class -- the class that you must subclass if you're writing an applet. Included in this package is the AudioClip interface which provides a very high level abstraction of audio. Writing Applets explains the ins and outs of developing your own applets.
37. What is meant by Reflection API?

Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running in the Java virtual machine. This is a relatively advanced feature and should be used only by developers who have a strong grasp of the fundamentals of the language.
38. What are the uses of Reflection?

Extensibility Features An application may make use of external, user-defined classes by creating instances of extensibility objects using their fully-qualified names. Class Browsers and Visual Development Environments A class browser needs to be able to enumerate the members of classes. Visual development environments can benefit from making use of type information available in reflection to aid the developer in writing correct code. Debuggers and Test Tools Debuggers need to be able to examine private members on classes. Test harnesses can make use of reflection to systematically call a discoverable set APIs defined on a class, to insure a high level of code coverage in a test suite. 7

39. What are the Drawbacks of Reflection?

Reflection is powerful, but should not be used indiscriminately. If it is possible to perform an operation without using reflection, then it is preferable to avoid using it. The following concerns should be kept in mind when accessing code via reflection. Performance Overhead Security Restrictions Exposure of Internals
40. What is object cloning in Java?

Objects in Java are referred using reference types, and there is no direct way to copy the contents of an object into a new object. The assignment of one reference to another merely creates another reference to the same object. Therefore, a special clone() method exists for all reference types in order to provide a standard mechanism for an object to make a copy of itself. Here are the details you need to know about cloning Java objects.
41. What is Inner Class in Java?

In Java it is possible to define one class inside another. A class defined inside another one is called an inner class . Java provides two kinds of inner classes--static and non-static.
42. Explain about Proxy Interface and Proxy Instance?

A proxy interface is such an interface that is implemented by a proxy class. A proxy instance is an instance of a proxy class.
43. What are the properties of Proxy Class?

Proxy classes are public, final, and not abstract. A proxy class extends java.lang.reflect.Proxy. Each proxy class has one public constructor that takes one argument. If a proxy class implements a non-public interface. UNIT - III

44. What are classes in Graphics Programming?

JCanvas. perform the usual JBox.

A JComponent that behaves as a Graphics2D object. You can

drawing operations directly on a JCanvas. A container for other Swing components. A JBox works almost like a Box object in Swing, but oers easier control over the layout of components in the box. This means that a JBox can be used as an alternative to a number of dierent layout managers. JEventQueue. An event-handler for the usual events in Swing programs. The events are placed in a queue and the program can then extract them. Using a JEventQueue is an alternative to writing programs in an eventdriven style. 8

45. Explain the types of events occur in a graphic based Program?

Events from pressing a button. Events from state based components. Events from text component. Events from a canvas. Timers. Menus. Window events.

46. Explain Component with example.

A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user. Examples of components are the buttons, checkboxes, and scrollbars of a typical graphical user interface.
47. Explain about graphics in the Java 2 platform.

public void paintComponent(Graphics g) { // Clear background if opaque super.paintComponent(g); // Cast Graphics to Graphics2D Graphics2D g2d = (Graphics2D)g; // Set pen parameters g2d.setPaint(fillColorOrPattern); g2d.setStroke(penThicknessOrPattern); // Allocate a shape SomeShape s = new SomeShape(...); // Draw shape g2d.draw(s); // outline g2d.fill(s); // solid }
48. What is an Event Listener?

An event listener is an object to which a component has delegated the task of handling a particular kind of event. In other words, if you want an object in your program to respond to another object which is generating events, you must register your object with the event generating object, and then handle the generated events when the come.
49. What is an adapter?

It convert the existing interfaces to a new interface to achieve compatibility and reusability of the unrelated classes in one application. Also known as Wrapper pattern.
50. What are the adapter classes in Java API?

The famous adapter classes in Java API are WindowAdapter,ComponentAdapter, ContainerAdapter, FocusAdapter, KeyAdapter, MouseAdapter and MouseMotionAdapter.
51. What is an action in Java?

An Action can be used to separate functionality and state from a component. For example, if you have two or more components that perform the same function, consider using an Action object to implement the function.
52. What are the two ways that used for Swing Timers?

To perform a task once, after a delay. For example, the tool tip manager uses Swing timers to determine when to show a tool tip and when to hide it. To perform a task repeatedly. For example, you might perform animation or update a component that displays progress toward a goal.

53. What is the use of Mouse Event?

Mouse events notify when the user uses the mouse (or similar input device) to interact with a component. Mouse events occur when the cursor enters or exits a component's onscreen area and when the user presses or releases one of the mouse buttons.
54. What is ActionEvent?

This is the ActionEvent class extends from the AWTEvent class. It indicates the component-defined events occurred i.e. the event generated by the component like Button, Checkboxes etc. The generated event is passed to every EventListener objects that receives such types of events using the addActionListener() method of the object.
55. What is AdjustmentEvent?

This is the AdjustmentEvent class extends from the AWTEvent class. When the Adjustable Value is changed then the event is generated.
56. What is ComponentEvent?

ComponentEvent class also extends from the AWTEvent class. This class creates the low-level event which indicates if the object moved, changed and it's states (visibility of the object). This class only performs the notification about the state of the object. The ComponentEvent class performs like root class for other component-level events.
57. What is ContainerEvent?

The ContainerEvent class extends from the ComponentEvent class. This is a low-level event which is generated when container's contents changes because of addition or removal of a components.
58. What is FocusEvent?

The FocusEvent class also extends from the ComponentEvent class. This class indicates about the focus where the focus has gained or lost by the object. The generated event is passed to every objects that is registered to receive such type of events using the addFocusListener() method of the object.
59. What is InputEvent?

The InputEvent class also extends from the ComponentEvent class. This event class handles all the component-level input events. This class acts 10

as a root class for all component-level input events.


60. What is ItemEvent?

The ItemEvent class extends from the AWTEvent class. The ItemEvent class handles all the indication about the selection of the object i.e. whether selected or not. The generated event is passed to every ItemListener objects that is registered to receive such types of event using the addItemListener() method of the object.
61. What is KeyEvent?

KeyEvent class extends from the InputEvent class. The KeyEvent class handles all the indication related to the key operation in the application if you press any key for any purposes of the object then the generated event gives the information about the pressed key. This type of events check whether the pressed key left key or right key, 'A' or 'a' etc.
62. What is MouseEvent?

MouseEvent class also extends from the InputEvent class. The MouseEvent class handle all events generated during the mouse operation for the object. That contains the information whether mouse is clicked or not if clicked then checks the pressed key is left or right.
63. What is PaintEvent?

PaintEvent class also extends from the ComponentEvent class. The PaintEvent class only ensures that the paint() or update() are serialized along with the other events delivered from the event queue.
64. What is TextEvent: ?

TextEvent class extends from the AWTEvent class. TextEvent is generated when the text of the object is changed. The generated events are passed to every TextListener object which is registered to receive such type of events using the addTextListener() method of the object.
65. What is WindowEvent?

WindowEvent class extends from the ComponentEvent class. If the window or the frame of your application is changed (Opened, closed, activated, deactivated or any other events are generated), WindowEvent is generated.
66. What is Swing?

Swing is basically a set of customisable graphical components whose lookand-feel can be dictated at runtime. Pre-built look-and-feel: Motif, Windows, Macintosh, Metal on a any platform Personal look-and-feel also definable
67. What are the Features of Swing?

Do not depend on native peers to render themselves. Simplified graphics to paint on screen Similar behaviour across all platforms Portable look and feel 11

Only a few top level containers not lightweight.

68. Explain about the Swing Components?

JApplet simple extension of java.applet.Applet class for use when swing programs are designed to be used in web browser or appletviewer JDialog replacement for java.awt.Dialog provides information and simple user prompts. JOptionPane class is a new Swing alternative for easy creation of simple dialogs. JFrame Most common container JWindow A window container 69. Explain about the Swing Package ? javax.swing Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
70. Explain about Controller Design Pattern?

The Front Controller pattern defines a single component that is responsible for processing application requests. A front controller centralizes functions such as view selection, security, and templating, and applies them consistently across all pages or views.
71. Explain about the Java Model.

The Java model is the set of classes that model the objects associated with creating, editing, and building a Java program. These classes implement Java specific behavior for resources and further decompose Java resources into model elements.
72. List the types of Views in Java?

AsyncBoxView, ComponentView, CompositeView, GlyphView, IconView, ImageView, PlainView


73. Explain about the Button.

The Button class creates pushbuttons with text labels. Java doesn't have a built-in class that supports buttons with images, but in Section 13.3 we'll build one by extending the Canvas class. The most common usage is to simply create one with a specified label, drop it in a window, then watch for action events to see if it has been pressed. For instance, to create a button and add it to the current window, you'd do something like the following: Button button = new Button("..."); add(button);
74. Explain about the Layout Management?

Some containers, such as JTabbedPane and JSplitPane, define a particular arrangement for their children. Other containers such as JPanel (and 12

JFrame, JDialog, and other top-level containers that use JPanel as their default content pane) do not define any particular arrangement. When working with containers of this type, you must specify a LayoutManager object to arrange the children within the container. UNIT - IV
75. What is Generic Programming?

a. b. c. d.

Programming with generic parameters Programming by abstracting from concrete types Programming with parameterized components Programming method based in finding the most representation of efficient algorithms Great benefits with types, but code reuse is an issue: int sqr(int i, int j) { return i*j; } double sqr(double i, double j) {return i*j; } The notion of sqr is the same but we must define it twice because of types Generic programming addresses this problem by being able to write generic code that applies to any type o T sqr(T i, T j) { return i*j; }

76. Explain about the motivation of Generic Programming?

77. Define Generics.

Generics provides a way for you to communicate the type of a collection to the compiler, so that it can be checked. Once the compiler knows the element type of the collection, the compiler can check that you have used the collection consistently and can insert the correct casts on values being taken out of the collection.
78. Explain about Generic Methods.

Consider writing a method that takes an array of objects and a collection and puts all objects in the array into the collection. Here is a first attempt: static void fromArrayToCollection(Object[] a, Collection<?> c) { for (Object o : a) { c.add(o); // compile time error }}
79. What is Java Reflection?

Java's Reflection API's makes it possible to inspect classes, interfaces, fields and methods at runtime, without knowing the names of the classes, methods etc. at compile time. It is also possible to instantiate new objects, invoke methods and get/set field values using reflection.
80. What is The Generics Reflection Rule of Thumb?

Using Java Generics typically falls into one of two different situations: 1. Declaring a class/interface as being parameterizable. 13

2. Using a parameterizable class.


81. How reflection handles generic types and methods?

The type parameters of generic type definitions and generic method definitions are represented by instances of the Type class. If an instance of Type represents a generic type, then it includes an array of types that represent the type parameters (for generic type definitions) or the type arguments (for constructed types). The same is true of an instance of the MethodInfo class that represents a generic method.

82. What is an Exception?

An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.

83. Explain about Exception Object and Throwing an Exception.

When an error occurs within a method, the method creates an object and hands it off to the runtime system. The object, called an exception object, contains information about the error, including its type and the state of the program when the error occurred. Creating an exception object and handing it to the runtime system is called throwing an exception.
84. What is Exception Handler?

The runtime system searches the call stack for a method that contains a block of code that can handle the exception. This block of code is called an exception handler.

85. Explain about Java Hierarchy.

14

The base of the Java exception hierarchy.


86. What are the three kinds of Exceptions?

The first kind of exception is the checked exception. The second kind of exception is the error. The third kind of exception is the runtime exception.

87. What is Run time Exception?

Runtime exceptions are usually caused by data errors, like arithmetic overflow, divide by zero. Runtime exceptions are not business related exceptions. In a well debugged code, runtime exceptions should not occur. Runtime exceptions should only be used in the case that the exception could be thrown by and only by something hard-coded into the program.
88. What are the Main Exception Classes?

java.lang.Throwable java.lang.Error java.lang.Exception java.lang.RuntimeException java.lang.NullPointerException Calling an instance method on the object referred by a null reference. Accessing or modifying an instance field of the object referred by a null reference. 15

89. Explain the Null Pointer Exception.

If the reference type is an array type, taking the length of a null reference. If the reference type is an array type, accessing or modifying the slots of a null reference. If the reference type is a subtype of Throwable, throwing a null reference. 90. When A catch-block will "catch" a thrown exception? The thrown exception object is the same as the exception object specified by the catch-block The thrown exception object is the subtype of the exception object specified by the catch-block
91. Explain about class StackTraceElement.

An element in a stack trace, as returned by Throwable.getStackTrace(). Each element represents a single stack frame. All stack frames except for the one at the top of the stack represent a method invocation. The frame at the top of the stack represents the the execution point at which the stack trace was generated.
92. Define a Stack Trace.

A stack trace provides information on the execution history of the current thread and lists the names of the classes and methods that were called at the point when the exception occurred. A stack trace is a useful debugging tool that you'll normally take advantage of when an exception has been thrown.
93. Explain about Logging API.

The next code snippet logs where an exception occurred from within the catch block. However, rather than manually parsing the stack trace and sending the output to System.err(), it sends the output to a file using the logging facility in the java.util.logging package.
94. What is Assertion in Java?

The assertions ensures the program validity by catching exceptions and logical errors. They can be stated as comments to guide the programmer. Assertions are of two types: 1) Preconditions 2) Postconditions. Preconditions are the assertions which invokes when a method is invoked and Postconditions are the assertions which invokes after a method finishes.
95. Where to use Assertions?

We can use assertions in java to make it more understanding and user friendly, because assertions can be used while defining preconditions and post conditions of the program. Apart from this we can use assertions on internal, control flow and class invariants as well to improve the programming experience.
96. What are the Four Main Targets uses of the logs?

16

Problem diagnosis by end users and system administrators. Problem diagnosis by field service engineers. Problem diagnosis by the development organization. Problem diagnosis by developers. Logger LogRecord Handler Level Filter Formatter UNIT - V

97. What are the key elements of this package?

98. Draw a Life Cycle of Thread.

99.

What is the thread Concepts? Thread


Synchronization Inter thread Communication Thread Deadlock Thread Control: Suspend, Stop and Resume

100.

What is an Interruption? Interruption is a mechanism whereby a thread that is waiting (or sleeping) can be made to prematurely stop waiting. What are the three main issues with thread priorities?

101.

They don't always do what you might intuitively think they

do; Their behavior depends on the platform and Java version: e.g. in Linux, priorities don't work at all in Hotspot before Java 6, 17

and the mapping of Java to OS priorities changed under Windows between Java 5 and Java 6; In trying to use them for some purpose, you may actually interfere with more sensible scheduling decisions that the OS would have made any way to achieve your purpose.
102.

What is Thread Synchronization? In a multithreaded environment, each thread has its own local thread stack and registers. If multiple threads access the same resource for read and write, the value may not be the correct value. For example, let's say our application contains two threads, one thread for reading content from the file and another thread writing the content to the file. If the write thread tries to write and the read thread tries to read the same data, the data might become corrupted. In this situation, we want to lock the file access. What are the thread synchronization methods?

103.

Event Mutex Semaphore Critical Section


104.

What is Interface Executor? An Executor is normally used instead of explicitly creating threads. For example, rather than invoking new Thread(new(RunnableTask())).start() for each of a set of tasks, you might use: Executor executor = anExecutor; executor.execute(new RunnableTask1()); executor.execute(new RunnableTask2());

105.

Explain Event Driven Programming in Java. User-interface objects (such as buttons, list boxes, menus, etc.) keep an internal list of "listeners". These listeners are notified (that is, the listeners methods are called) when the user-interface object generates an event. To add listeners to the list you make a call like yellowButton.addActionListener(...). What you put in the place of the ... must be an object implementing the ActionListener interface, so it will have methods capable of processing the events generated. Of course, if the interface is not a button or menu, ActionListener may not be the appropriate interfacethere are eleven listener interfaces. How to create an Event Handlers? The first step in developing an event-driven program is to write a series of subroutines, or methods, called event-handler routines. 18

106.

The second step is to bind event handlers to events so that the correct function is called when the event takes place. The third step in developing an event-driven program is to write the main loop.

19

Vous aimerez peut-être aussi