Index Course Outline Grading Policy Lab Time Distribution Important Instructions 2
Course Outline Week Topics 1 - History and Evolution of Java - Overview of Java 2 - Datatypes - Variables 3 - Arrays 4 - Operators - Assignment 1 Collected 3
Course Outline.Continued Week Topics 5 - Control Statements 6 - Introducing Classes 7 - Methods and classes and their relations - Assignment 2 Collected 8 - Mid Term Exam 4
Course Outline.Continued Week Topics 9 - Inheritance 10 - Packages and Interfaces 11 - Exception Handling 12 - Multi-Threading Programming -1 - Assignment 3 Collected 5
Course Outline.Continued Week Topics 13 - Multi-Threading Programming -2 14 - String Handling 1 15 - String handling 2 - Assignment 4 Collected 16 - End Term Exam 6
Grading Policy Attendance 10% Assignments 20% (Each assignment = 5%) Mid Term Exam 20% End Term Exam 40% Discipline & Miscellaneous. 10% 7
Lab Time Distribution Teaching Slides 30 45 minutes Query Session 10 minutes Break Time 20 minutes Lab Assignments & Programming Practice Remaining Time 8
Important Instructions 1. Maintain one separate file for Lab assignments 9
Important Instructions 2. Take printout of each completed assignment and keep it in the Lab file 10
Important Instructions 3. Each Program in the assignment will be given an unique ID. Please refer the program using only this ID in the Lab file 11
Important Instructions 4. All four assignments should be submitted to me in the beginning of the lab. 12
Advisor : Dr. Navrati Saxena Room : #23412 Email: navrati@ece.skku.ac.kr Phone No. : 299-4676 TA: Rochak Sachan Room No. : 23403B Email: rochak@skku.edu Phone No. : 299-4676
security At the end of the lesson, the YOU should be able to: The features of Java technology such as the Java virtual machine (JVM), garbage collection (GC) and code The different phases of a Java program
Java: was created in 1991 by James Gosling et al. of Sun Microsystems Initially called Oak, in honor of the tree outside Gosling's window, its name was changed to Java because there was already a language called Oak.
Java: The original motivation for Java The need for platform independent language that could be embedded in various consumer electronic products like toasters and refrigerators. One of the first projects developed using Java A personal hand-held remote control named Star 7 At about the same time, the World Wide Web and the Internet were gaining popularity. Gosling et. al. realized that Java could be used for Internet
The Java technology is: - A programming language - A development environment - An application environment
Features of JAVA Robust Distributed Multi-threading Security Portability High Performance
Features of JAVA Robust Automatic type checking. Provides automatic garbage collection for unused objects. No pointers.
Features of JAVA (cont ) Distributed The ultimate vision of OOP is to have objects stored on different computers to interact with each other. That is, a user can assemble a program different parts of which are stored on different computers.
Features of JAVA (cont ) Multi-threading Java allows you to write programs to perform multiple tasks simultaneously. Security Protects against unauthorized access to local file systems. Portability Write once, run anywhere feature.
Features of JAVA (cont ) High Performance: It has a compiler that generates Machineindependent byte codes. Java provides native method support, for code written in languages like C/C++, and compiled for specific platforms.
Overview of JAVA Abstraction: It s an overview of an object by ignoring it s internal complicated features. Ex. Car 13
OOP (Object Oriented Programming): How is Abstraction performed in JAVA? Answer: Through the 3 principles of OOP (Object Oriented Programming) The 3 Principles of OOP: Encapsulation Inheritance Polymorphism 14
OOP (Cont ): Encapsulation It is a mechanism that binds code and the data it manipulates, and keeps both safe from outside interference and misuse. The power of encapsulated code is that everyone knows how to access it and thus can use it regardless of the implementation details and without fear of unexpected side effects. In Java the basis of encapsulation is the class.
OOP (Cont ): Inheritance It is the process by which one object acquires the properties of another object. It supports the concept of hierarchical classification. Ex. Human
OOP (Cont ): Polymorphism One interface, Multiple methods
The JDK JDK Java Development Toolkit This can be downloaded free of cost from http://java.sun.com. The JDK can be downloaded for different platforms: Windows, Unix (Solaris), MacOS. Comes as a self-extracting exe Certain environment variables, such as PATH and CLASSPATH need to be set/reset.
How It works?? Some of the important utilities available under jdk: javac The java compiler, convert source code into byte code stored in class files. java The java interpreter that executes byte code for a java application from class files. Java Source (.java) Java Compiler Java Bytecode (.class ) Java Interpreter
First Java Program : Step 1: Enter the Java source code: Use any non-document text editor. Program code /** * The simple program to display Hello World! */ public class HelloWorld { public static void main (String args[]) { //Here s your print statement System.out.println( Hello world! ); } }
First Java Program (Cont ) : Step 2: Save the source in a file: The file MUST have the same name as the public class in the source, and must have a.java extension. That is, the above file should be saved as HelloWorld.java with the case maintained. Step 3: Compile the source file using javac: Use the following command line at the shell prompt javac HelloWorld.java If the code is correct, compilation will produce the file HelloWorld.class if there are errors, repeat steps 1-3.
First Java Program (Cont ) : Step 4: Run the compiled code Invoke the java interpreter by the command line java HelloWorld Output: Hello World!
References : Differences and similarities between java and c++ : http://www.dickbaldwin.com/java/java008.htm Java 2 The Complete Reference (7 th edition) Author : Herbert Scheldt