Professional Documents
Culture Documents
Fundamental Concepts
• It's Simple
• It's Object Oriented
• It's Safe
• It's Secure
• It's Portable
• It's Fast (potentially)
• It's Multi-threaded
• It is platform independent
• Arithmetic Operators ( + - * / %)
• Assignment Operators (+= -= *= /= %= =)
• Increment & Decrement Operators ( ++ -- :
Pre & Post)
• Logical Operators [AND (& or &&), OR (| or ||), XOR (^)
NOT (!) ]
• Comparison Operators [ == != < > <= >= ]
• Bitwise Operators ( AND: & OR : | XOR : ^ Compliment: ~ )
import java.io.*;
class HelloWorld {
public static void main (String args[])
{ System.out.println("Hello, World!");
}
}
• Character
(char)System.in.read()
• String
in.readLine()
and more ..
• Objects
• Classes
• Encapsulation
• Constructors
• Inheritance
• Polymorphism
• Abstraction
• Single
– Subclass is derived from a single super super class
• Hierarchical
– Single super class is used to derive number of subclasses of the
same level
• Multilevel
– A derived class acting as a super class for another sub class
• Multiple (Not supported by java)
– A subclass derived from more than one super class
class a
class b class c .. ..
Java Programming K.S.Mahara 41
san
Inheritance contd..
Multilevel Inheritance
• The derived class of one base class acts as the base class
for another derived class
• ie. class a {..}
class b extends a {..}
class c extends d {..} .. ..
• Example programs on black board
Information Passing
• Applets can accept parameters from the HTML document
• <param> tag of HTML is used to pass parameters
• Applet uses getParameter() method to receive the values sent from HTML
document
• Applet Interfaces: AppletContext, AudioClip & AppletStub
• AWT can be used to create GUI based applets
» Sample programs
Java Programming K.S.Mahara 62
san
Applets contd.. Applet Development
• Import java.applet & java.awt packages for using applet
methods & displaying the results respectively
• Include the necessary statements & Save the file (no
main() method)
• Compile the file using javac
• Create a webpage having <applet> tag & embed the
applet’s class file in it.
• Execute the applet using Appletviewer or any java enabled
web browser (difference?)
• General Structure of an applet
import statements for awt , applet & etc.,
publicpublic class appCName extends Applet
{ .. .. .. Public void paint(Graphics g) { applet operation code }
}
• HTML <applet code = .. .. .class width = int height = int> </applet>
Advantages
• The properties, events and methods of a bean that are
exposed to an application builder tool can be controlled
• Bean configuration support software is available (not
needed during run-time)
• Bean’s configuration settings can be stored
• A Bean may receive from and send events to other
objects. (Registration is required)
Programming in Java