Slides1
- 格式:pdf
- 大小:1.87 MB
- 文档页数:55
A Simple Java Program
Example Code 1
Lecture 1 Java Basics
Algorithms Design and Analysis
A Simple Java Program
Typical Structure of a Program
Rules and convention: The file name must be the same as the class name The class name normally starts with capital letter The main method is what the program runs first The method names normally start with small-case letters
Save the program in a text file HelloWorld.java Executing the program in cmd
Lecture 1 Java Basics
Algorithms Design and Analysis
A Simple Java Program
Save the program in a text file HelloWorld.java Executing the program in cmd
Lecture 1 Java Basics
Lecture 1 Java Basics Algorithms Design and Analysis
Programming is NOT hard.
Programming is like driving; you can’t learn it unless you put yourself behind the wheels.
Lecture 1 Java Basics Algorithms Design and Analysis
A Simple Java Program
Example Code 1
Lecture 1 Java Basics
Algorithms Design and Analysis
A Simple Java Program
A Simple Java Program
Example Code 1
Lecture 1 Java Basics
Algorithms Design and Analysis
A Simple Java Program
Example Code 1
Lecture 1 Java Basics
Algorithms Design and Analysis
Algorithms Design and Analysis
Lecture 1 Java Basics
2014, CJLU
Lecture 1 Java Basics
Algorithms Design and Analysis
Course Organization
Instructor: Jiamou Liu Email: jiamou.liu@ QQ: 2307107581 Assessments: Assignments (Due Dates: November 1, December 20): 20% each Test (October): 10% Final Exam: 50% Other Resources: A Concise and Practical Introduction to Programming Algorithms in Java (Frank Nielson) Java Structures (Duane Bailey) / bailey/JavaStructures/ Algorithms (Sangoy Dasgupta, Christos Papadimitrious, Umesh Vazirani, 2006) Data Structures and Algorithms (Aho,Ullman,Hopcroft)
Algorithms Design and Analysis
Another Simple Java Program
Example Code 2 /** * The second Java program of ADA 2014 * @Author: Jiamou Liu */ class VolumeBox { // This is the main method public static void main (String[] args) { System.out.print("Volume of the box:"); System.out.println(0.5*1*0.2); } }
Algorithms Design and Analysis
A Simple Java Program
Save the program in a text file HelloWorld.java Executing the program in cmd
Lecture 1 Java Basics
Algorithms Design andBasics
Algorithms Design and Analysis
Java Arithmetic Operations
Addition: + Subtraction: Multiplication: * Division: / Modulo (remainder): % Note: When dividing an integer by another integer, the result is an rounded integer: If positive, then round down. e.g. 5 2 ⇒ 2 If negative, then round up. e.g. −5 2 ⇒ −2
Example Code 1
Lecture 1 Java Basics
Algorithms Design and Analysis
A Simple Java Program
Example Code 1
Lecture 1 Java Basics
Algorithms Design and Analysis
Lecture 1 Java Basics
Algorithms Design and Analysis
Course Plan
1 2 3 4 5 6 7 8 9 10 11 12
Java Basics Object-Orientation Introduction to Algorithms Sorting and Divide and Conquer Trees and Priority Queues Search Trees Introducing Graphs Graphs Representations Simple Graph Algorithms Shortest Path Problem and Minimal Spanning Trees Greedy Algorithms Dynamic Programming
Lecture 1 Java Basics Algorithms Design and Analysis
Introduction to Java
Why Java? Java is popular There are reportedly 9 million Java developers in the world (in 2014), 930 million Java Runtime Environment downloads each year and 3 billion mobile phones run Java. Java is modern A high level programming language that is based on the object-oriented paradigm. Java is convenient Automatic memory management Java is portable: Java programs run similarly on any hardware/OS platforms. Java is powerful The Java standard library offers a wealth of tools for different functions.
Lecture 1 Java Basics
Algorithms Design and Analysis
Another Simple Java Program
Example Code 2 /** * The second Java program of ADA 2014 * @Author: Jiamou Liu */ class VolumeBox { // This is the main method public static void main (String[] args) { System.out.print("Volume of the box:"); System.out.println(0.5*1*0.2); } } Output: Volume of the box:0.1
Lecture 1 Java Basics
Algorithms Design and Analysis
A Simple Java Program
Save the program in a text file HelloWorld.java Executing the program in cmd
Lecture 1 Java Basics