Advanced Programming in Java Sadegh Aliakbary Sharif University
Advanced Programming in Java Sadegh Aliakbary Sharif University of Technology Fall 2010
Agenda �Introduction to Course �Java History �Java Characteristics �First Example �Syllabus �Evaluation Policy Fall 2010 Sharif University of Technology 2
This Course Covers: �Java programming language �Object Oriented Concepts �Some Programming Skills �Test �Refactoring �Code Smell Fall 2010 Sharif University of Technology 3
Java History �Java was created in 1991 �by James Gosling in 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. �Sun Microsystems released the first public implementation as Java 1. 0 in 1995 �Java syntax is similar to C and C++. Fall 2010 Sharif University of Technology 4
Java Motivation �The need for platform independent language �To be embedded in various consumer electronic products �like toasters and refrigerators �Platform independent? ! �Hardware �Operating System Fall 2010 Sharif University of Technology 5
Java Motivation (2) �At the same time, the World Wide Web and the Internet were gaining popularity. �Java could be used for Internet programming. �Why? �Platform independence �Creation of Applets �Now, Java is used mostly for server-side programming Fall 2010 Sharif University of Technology 6
The Java technology is: �A programming language �Java can create all kinds of applications �A development environment �A compiler (javac) �An interpreter (java) �A documentation generator (javadoc) �… �Compare it to C++ Fall 2010 Sharif University of Technology 7
High-Level Languages Fall 2010 Sharif University of Technology 8
Java Virtual Machine Fall 2010 Sharif University of Technology 9
Compile and Execution Stages �Compare to C++ and Assembly �. NET Framework Fall 2010 Sharif University of Technology 10
First Example �Create a file named First. java �Java class files have. java extension �Note to naming convention �Copy this lines to the file �Note: File name and class name should be the same. Fall 2010 Sharif University of Technology 11
First Example (2) �Run javac First. java �Run java First �We don’t use any IDE now. �To highlight compile and run stages. �Lets watch it in real world! Fall 2010 Sharif University of Technology 12
Overview of the Example Fall 2010 Sharif University of Technology 13
Java is Popular �Some reports on programming languages popularity �According to �Job advertisements �Book sales �Finding code on the web �… Fall 2010 Sharif University of Technology 14
�http: //www. langpop. com �updated in 2010 Fall 2010 Sharif University of Technology 15
http: //www. tiobe. com/index. php/content/paperinfo/tpci/index. html Fall 2010 Sharif University of Technology 16
Characteristics of Java �Java is simple �Java is object-oriented �Java is architecture-neutral �Java is portable �Java is interpreted �Java is multithreaded �Java is secure �Java is robust Fall 2010 Sharif University of Technology 17
Conclusion �Java is a �Simple �object oriented �Robust �And popular �Java is platform independent. �Write Once, Run Anywhere! Fall 2010 Sharif University of Technology 18
Further Reading �Read Java page on Wikipedia http: //en. wikipedia. org/wiki/Java_(programming_language) �Google this terms and phrases: �Java Mobile �JVM �Byte code �Java Sun Fall 2010 �Java and C++ �Java and C# Sharif University of Technology 19
Exercises �Download and install JDK �Write a program that prints your name on the console �Compile and run the program Fall 2010 Sharif University of Technology 20
Evaluation Policy �Final Exam: 4 �Midterm Exam 1: 2 �Midterm Exam 2: 2 �Quiz & Attendance : 4 �Assignments: 3 �Projects: 6+ (Sum=21) �If you don’t want to attend this class… Fall 2010 Sharif University of Technology 21
Topics �Introduction to java language �Java syntax, operators, conditions, loops, … �Strings �Arrays �Object Oriented Programming �Inheritance �Polymorphism �Collections �Generics Fall 2010 Sharif University of Technology �Exception Handling �Files and I/O �Threads �Reflection �Test �Refactoring �GUI �Networking 22
Fall 2010 Sharif University of Technology 23
- Slides: 23