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...
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...
String handling in java: (OR) String manipulations in java: Strings represents a sequence of immutable characters. Or string is an object that represents a sequence of characters or char values. The java.lang. String class is used to create a Java string object. --->The length of the String object is fixed. --->String object is immutable and cannot be modified. --->Strings are used for storing text. How many ways we can create the string object? There are two ways to create a String object: 1.Using string literal 2.Using new keyword Strings may be declared and created as follows: 1. By string literal : Java String literal is created by using double quotes. For Example: String s="HelloWorld"; 2. By new keyword : Java String is created by using a keyword "new". For example: String stringName; StringName=new String("HelloWorld"); Or We can combine above statements. String s=new String("...
Comments
Post a Comment