

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture was delivered by Nauman Shamim at Pakistan Institute of Engineering and Applied Sciences, Islamabad (PIEAS). it includes Java, Network, Programming, Highlighted, Features, Platform, Independent, Internationalization, Application, Development, API
Typology: Lecture notes
1 / 41
This page cannot be seen from the preview
Don't miss anything!


































DCIS,PIEAS
DCIS,PIEAS
o 2 weeks o 5 days a week o Two lecture and two labs daily
o Books o Lectures
DCIS,PIEAS
o Java is a simple, secure object oriented language, it inherits features from C/C++. o Developed by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, Mike Sheridan at Sun Microsystems in 1991 o Initially named “Oak” o Primary motives
DCIS,PIEAS
o The unicode character set
DCIS,PIEAS
DCIS,PIEAS
o Core development tools o Standard set of libraries
o Javac
DCIS,PIEAS
DCIS,PIEAS
How
Java
Works
DCIS,PIEAS
The program should be saved to a file named HelloWorld.java
main method
Class Name
a Class
an object method
DCIS,PIEAS
Compiling and Executing HelloWorld Program
javac HelloWorld.java It will generate the HelloWorld.class on command prompt write java HelloWorld Output Hello World c:> cd jbuilder C:>jbuilder7>cd jdk1.3. C:>jbuilder7>jdk1.3.1> cd bin C:>jbuilder7>jdk1.3.1> bin>javac HellowWordl.java C:>jbuilder7>jdk1.3.1> bin>java HelloWordl Hello World C:>jbuilder7>jdk1.3.1> bin>
DCIS,PIEAS
Numeric Data Types
byte 8 bits
short 16 bits
int 32 bits
long 64 bits
float 32 bits
double 64 bits
Non-Numeric
char 16 bit (java uses unicode character set,that is the unification of many character set of other languages and can represent almost each human language character set , a major part of this set is empty)
DCIS,PIEAS
Identifiers
An identifier must start with a letter, an underscore, or a dollar sign.
Declaring and Initializing Integers and Floats
int i = 34;
long l = 1000000;
float f = 100.2f; or float f = 100.2F;
double d = 100.2d or double d = 100.2D;
DCIS,PIEAS
Declaring and initializing cont..
Constants final data_type CONSTANTNAME = VALUE;
DCIS,PIEAS
System.out.println(“Any string”+variable+”Other string”);
Exanmple
public class Student{
public static void main(String s[]){ int code=911; System.out.println(“Mr. Anonymous “+code); System.out.print(“Mr. “); System.out.print(“ Anonymous “); System.out.print(code); }
}
Mr.Anonymous 911
Mr.Anonymous 911