How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For



Similar documents
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Java Crash Course Part I

Crash Course in Java

Java CPD (I) Frans Coenen Department of Computer Science

Java Cheatsheet. Tim Coppieters Laure Philips Elisa Gonzalez Boix

Introduction to Java

Chapter 1 Java Program Design and Development

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

CS 106 Introduction to Computer Science I

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

An Overview of Java. overview-1

Moving from CS 61A Scheme to CS 61B Java

A Short Introduction to Writing Java Code. Zoltán Majó

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

CS 209 Programming in Java #1

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Habanero Extreme Scale Software Research Project

Java Programming Fundamentals

The C Programming Language course syllabus associate level

Java with Eclipse: Setup & Getting Started

Java (12 Weeks) Introduction to Java Programming Language

CS 111 Classes I 1. Software Organization View to this point:

Contents. Java - An Introduction. Java Milestones. Java and its Evolution

Chapter 1 Fundamentals of Java Programming

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

CS1020 Data Structures and Algorithms I Lecture Note #1. Introduction to Java

Java Interview Questions and Answers

Java applets. SwIG Jing He

AP Computer Science Java Subset

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

Java Application Developer Certificate Program Competencies

Introduction to Java. CS 3: Computer Programming in Java

java Features Version April 19, 2013 by Thorsten Kracht

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Part I. Multiple Choice Questions (2 points each):

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Programmierpraktikum

Fundamentals of Java Programming

Remote Method Invocation

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Lecture 5: Java Fundamentals III

J a v a Quiz (Unit 3, Test 0 Practice)

Installing Java (Windows) and Writing your First Program

CSC 551: Web Programming. Spring 2004

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Java programming for C/C++ developers

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Tutorial: Getting Started

CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.

Introduction to Java Lecture Notes. Ryan Dougherty

Tutorial on Writing Modular Programs in Scala

Introduction to Object-Oriented Programming

LAB4 Making Classes and Objects

Example of a Java program

Programmation 2. Introduction à la programmation Java

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

El Dorado Union High School District Educational Services

C# and Other Languages

Java Software Development Kit (JDK 5.0 Update 14) Installation Step by Step Instructions

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

Java Classes. GEEN163 Introduction to Computer Programming

Langages Orientés Objet Java

Chapter 5 Aspect Oriented Programming

How to use the Eclipse IDE for Java Application Development

Tutorial 5: Developing Java applications

Computing Concepts with Java Essentials

University of Twente. A simulation of the Java Virtual Machine using graph grammars

Variables, Constants, and Data Types

Java Programming Language

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

More on Objects and Classes

1. Overview of the Java Language

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

DIPLOMADO DE JAVA - OCA

Lesson 06: Basics of Software Development (W02D2

Getting Started with the Internet Communications Engine

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Introduction. Why (GIS) Programming? Streamline routine/repetitive procedures Implement new algorithms Customize user applications

Fundamentals of the Java Programming Language

What Perl Programmers Should Know About Java

Chapter 2 Introduction to Java programming

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Sample CSE8A midterm Multiple Choice (circle one)

Lecture 1 Introduction to Android

Licence Informatique Année Exceptions

Sources: On the Web: Slides will be available on:

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction

CS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5

JAVA - INHERITANCE. extends is the keyword used to inherit the properties of a class. Below given is the syntax of extends keyword.

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Implementation Aspects of OO-Languages

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

Objectif. Participant. Prérequis. Remarque. Programme. C# 3.0 Programming in the.net Framework. 1. Introduction to the.

Java for WebObjects Developers. Provides a quick-start guide for developers learning to use Java with WebObjects

Transcription:

Projet Java Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan)

Objectives - Apprendre à programmer en Java - Travailler à plusieurs sur un gros projet qui a plusieurs aspects: graphisme, interface utilisateur, réseau, concurrence, optimisation. - Initiation à quelques notions de génie logiciel: classes/modules réutilisable, documentation, design patterns, tests unitaires, développement de test par scénarios.

Projet - Un projet à plusieurs aspects qui nécessitent un partage des tâches et le respect des interfaces fixées. - Le contenu du projet sera expliqué à une séance prochaine. Page web du cours: http://www.lsv.ens-cachan.fr/~sankur/java

Evaluation Il y aura - un mini devoir: 1/6 (dans un mois) - la première étape du projet: 2/6 -(fin Mars) - la deuxième étape du projet: 3/6 (fin Mai)

Calendrier - 25/01 08/02: Trois TP Java. - 15/02: Data limite du mini devoir. - 29/03: Première partie - 31/05: Deuxième partie (et soutenance) Il y aura des TP complémentaires sur le graphisme et réseaux, gestionnaires de version ou autre sur demande.

Introduction Present the syntax of Java Introduce the Java API Demonstrate how to build stand-alone Java programs Java applets, which run within browsers e.g. Netscape Example programs

Why Java? Very popular general-purpose language It s almost entirely object-oriented It has a vast library of predefined objects and operations It s platform independent this makes it great for Web programming It s more secure (than C, C++) It isn t C++

Java Virtual Machine The.class files generated by the compiler are not executable binaries Instead, they contain byte-codes to be executed by the Java Virtual Machine

Building JAVA Programs (on UNIX) Prepare the file Foo.java using an editor Invoke the compiler: javac Foo.java This creates Foo.class Run the java interpreter: java Foo

HelloWorld public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); } } - This code must be put in a file named HelloWorld.java, that is, the name of the public class. - public static void main(string [] args) is the main function to be executed first (at most one such function must be given).

Comments are almost like C++ /* This kind of comment can span multiple lines */ // This kind is to the end of the line /** * This kind of comment is a special * javadoc style comment */

Primitive data types are like C Main data types are int, double, boolean, char Also have byte, short, long, float boolean has values true and false Declarations look like C, for example, double x, y; int count = 0;

Expressions are like C Assignment statements mostly look like those in C; you can use =, +=, *= etc. Arithmetic uses the familiar + - * / % Java also has ++ and -- Java has boolean operators &&! Java has comparisons < <= ==!= >= > Java does not have pointers or pointer arithmetic

Control statements are like C if (x < y) smaller = x; if (x < y){ smaller=x;sum += x;} else { smaller = y; sum += y; } while (x < y) { y = y - x; } do { y = y - x; } while (x < y) for (int i = 0; i < max; i++) sum += i; BUT: conditions must be boolean!

Control statements II switch (n + 1) { case 0: m = n - 1; break; case 1: m = n + 1; case 3: m = m * n; break; default: m = -n; break; } Java also has exceptions (more on that later)

So, what is a class? A class is a blueprint for constructing objects, consisting of a collection of fields, or variables all the operations (called methods) that can be performed on those fields A class describes objects and operations defined on those objects

An example of a class class Person { String name; int age; } void birthday ( ) { age++; System.out.println (name+' is now '+age); } int getage(){ } return age;

An example of a class (cont'd) Person p = new Person(); p.name = John ; p.age = 100; p.birthday(); p.birthday();? Here, p is an object. While Person is its description.

A better example of a class class Person { private String name; private int age; } public Person(String name, int age){ this.age = age; this.name = name; } void birthday ( ) { age++; System.out.println (name+' is now '+age); } int getage(){ return age; } The method Person(String name, int age) is a constructor.

In the second version, we avoided modifying the attributes by hand. This is a good practice (see next). An example of a class (cont'd) Person p = new Person(); p.name = John ; p.age = 100 ; p.birthday(); p.birthday(); Compiler error! Attributes are private Correct (and nicer) version: Person p = new Person( John, 100); p.birthday(); p.birthday();

Object Oriented Programming - (Almost) any entity manipulated in your programs are objects, defined by classes. Classes: encapsulate all data related to the object. hide data related to the implementation. Provide methods by which one modifies the state of the object. General principle: You don't need to understand how a class works in order to use it. Just use the methods.

The class hierarchy Classes are arranged in a hierarchy The root, or topmost, class is Object Every class but Object has at least one superclass A class may have subclasses Each class inherits all the fields and methods of its (possibly numerous) superclasses

Example of hierarchy Class Person{ int age; String name; } class Driver extends Person { long driverslicensenumber; Date expirationdate; } Driver is a subclass of Person. Driver d = new Driver(); d.name = Nash ; d.age = 100; d.birthday();

Name conventions Class names begin with a capital letter All other names begin with a lowercase letter Subsequent words are capitalized: printbirthday() getdatafromfile() Underscores are not used in names: print_birthday() These are very strong conventions!

Compilation For now, edit with your favorite text editor compile with: javac *.java Or, you can try the popular IDE eclipse: http://www.eclipse.org/

Java API and Resources Java has a huge standard library (The Java API). From now on, your primary reference shall be: http://docs.oracle.com/javase/7/docs/api/ Very useful tutorials: Java Language: http://docs.oracle.com/javase/tutorial/java/index.html Other concepts (Network, concurrency, graphics ) http://docs.oracle.com/javase/tutorial/