Control statements in java : It is a statement that determines whether the other statements will be executed or not. It controls the flow of a program. control statements help with the control flow of the program. Control flow is the order in which the statements execute. Control Statements can be divided into three categories, namely A] Selection statement B] Iteration statement C] Jump statement Let us discuss above statements one by one as follow: A ] Decision-Making /Conditional /Selection statements: Statements that determine which statement to execute and when are known as decision-making statements. The flow of the execution of the program is controlled by the control flow statement. Selection statements allow your program to choose different paths of execution based upon the outcome of an expression or the state of a variable. Java supports two selection statements: I ] if statement: II ] switch statement: I] If st...
Java Applet : Applet is a special type of program that is embedded in the webpage to generate the dynamic content. It runs inside the browser and works at client side. Applets are basically small java programs which can be transported from one computer from another computer in the network. Life cycle of Java Applet : Or Explain the life cycle of an applet with example? Or Describe different stage of life cycle of an applet? Applet is initialized. (Initial state) Applet is started.(running state) Applet is painted.(Display state) Applet is stopped.(idle or stoped state) Applet is destroyed.(dead state) When an applet is executed within the web browser or in an applet window, it goes through the four stages of its life cycle: initialized, started, stopped and destroyed.These stages correspond to the applet methods init(), start(), stop() and destroy() respectively. -->All above mention methods are defined in java.applet.Applet class except paint...
Layout Manager in Java The LayoutManagers are used to arrange components in a particular manner. LayoutManager is an interface that is implemented by all the classes of layout managers. A layout manager is an object that controls the size and the position of the components in a container. The layout manager is set by the setLayout() method. If no call to setLayout( ) is made, then the default layout manager is used. Syntax : void setLayout(LayoutManager layoutObj) Here, layoutObj is a reference to the desired layout manager. If you wish to disable the layout manager and position components manually, pass null for layoutObj. Types of Layout managers : There are following classes that represents the layout managers: 1. java.awt.BorderLayout 2. java.awt.FlowLayout 3. java.awt.GridLayout 4. java.awt.CardLayout 1. BorderLayout : The BorderLayout is used to arrange the components in five regions: north, south, east, west and center. Each region (area) may co...
Comments
Post a Comment