Beruflich Dokumente
Kultur Dokumente
PROGRAMMING
(CSE-2104)
Course modules
Introduction
Language Basics
Introduction to classes, objects and methods
Inheritance
Interfaces
Course
Plan
Packages
Exception Handling
Multithreaded Programming
Generics
String handling
Using Input Output
Applets
CSE 2104
12/08/16 Swings and Event Handling
Department of CSE
Lab Manual
2
Course Outcomes
Understand the concepts Identify the use of
of Object Oriented
System libraries and
Programming
achieve
high
level
Achieve
reusability
reusability
using
using Inheritance and
generics
Packages
Understand
event
Appreciate the use of
handling and design
Exception handling and
small Java Applications
achieve
concurrency
using Swings
through Multithreading
Course Syllabus
BALACHANDRA
Dr. MAMATHA
CSE 2104
Department of CSE
INTRODUCTION TO JAVA
Origin of JAVA
Java is related to C++, which is a direct
descendent of C
From
Many
JAVA Applets
An applet is actually a tiny Java
program, dynamically downloaded
across the network, just like an image,
sound file, or video clip
Security
When you use a Java-compatible Web
browser, you can safely download Java
applets without fear of viral infection or
malicious intent
Java
achieves this protection by
confining a Java program to the Java
execution environment and not allowing
access to other parts of the computer
environment
Java is portable across many types of
computers and operating systems that
are in use throughout the world
August 6, 2009
11
Bytecode is
instructions
by the Java
called the
(JVM)
August 6, 2009
August 6, 2009
13
August 6, 2009
14
August 6, 2009
15
August 6, 2009
17
August 6, 2009
18
The use of bytecode enables the Java runtime system to execute programs much
faster than you might expect
August 6, 2009
19
August 6, 2009
20
Object-Oriented
Programming
In POP , Data is organized around the
code (code acting on data).
In OOP , Code is organized around the
data(data controlling access to code)
You define the data and the routines that
are permitted to act on the data.
Java is object-oriented.
In Java, a class encapsulates the data
and the routines acting on the data.
Copyright 2013 by The McGraw-Hill Companies, Inc. All
rights reserved.
Object-oriented programming is at
the core of Java
August 6, 2009
24
27
C:\>javac Example.java
28
29
August 6, 2009
30
31
August 6, 2009
32
33
August 6, 2009
34
Lexical Issues
Whitespace:
Java is a free-form language
In Java, whitespace is a space, tab, or newline
Identifiers:
- Identifiers are used for class names, method
names, and variable names
-Identifiers can contain alphabet, digits,
underscore and dollar symbol
- Identifier cannot start with a digit
- Java is case-sensitive
August 6, 2009
35
August 6, 2009
36
Literals:
A constant value in Java is created by
using a literal representation of it
August 6, 2009
37
Comments
There are three types of comments
defined by Java.
Single-line (// )and multiline (/* */ )
The third type is called a documentation
comment
This type of comment is used to
produce an HTML file that documents
your program
The documentation comment begins
with a /** and ends with a */
August 6, 2009
38
Separators
August 6, 2009
39
40
August 6, 2009
41