Java - Foundations Application Programming Interfaces...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Mamadou K. Traoré Foundations Application Programming Interfaces Distributed programming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Foundations Basics Syntax Environment Object-oriented programming Classification Relationship
Background image of page 2
Syntax Object oriented programming language Defined by Sun Microsystems in 1995 (J. Gosling’s team) for remote monitoring of domestic apparels Oak to become Java Stable version since Java 1.2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Syntax > lexical elements Comments: // this is a comment (one line) /* this also is a comment */ /** and this also (generated by javadoc , a java documentation generator) */ Separators: { // this is a bloc, it must contain instructions } // Single instructions ends with ; // space is a natural separator Identifier (style): item // classic way to name something my V ariable // clearer than myvariable my G raphical O bject // clearer than mygraphicalobject S tring // class name G raphical O bject // class name clearer than Graphicalobject _ RemoteDate // predefined class name PI // constant value java . io // package name with affiliation to mother package Data types: char // letters, digits and symbols coded in unicode int // from -2 147 483 648 to 2 147 483 647 float // from -3.4 10 -38 to 3.4 10 38 double // from -1,7 10 -308 to 1,7 10 308 boolean // true or false byte // from -128 to 127 short // from -32 768 to 32767 long // from -9223372036854775808 to 9223372036854775807 Key words (not all): abstract break byte case cast catch class continue default do else extends false final finally for future generic goto if implements import inner instanceof interface native new null operator package private protected public return static super switch synchronized this throw throws true try var void while
Background image of page 4
Variables: int nb; // <type name> <variable name> double x,y; boolean answer=true; // initialization float z, gamma=9.8, t; Constant: final double PI = 3.14; Basic operators: = += -= *= /= // priorities: 15 for all + - * / % ++ -- // priorities: 5 (or 2) , 5 (or 2), 4, 4, 4, 1, 1 // priorities: 2, 9, 11, 10, 13, 12 < > <= >= == != // priorities: 7, 7, 7, 7, 8, 8 Casting: int nb, short i; nb = i; // implicit cast i = (short) nb; // explicit cast Arrays: int collection[ ]; // or int[ ] collection boolean agenda[ ][ ]; // or boolean[ ][ ] agenda double m[ ], x, m2[ ][ ]; // or double x; double[ ] m; double[ ][ ] m2; collection = new int[10]; // creations => collection. length = 10 agenda = new boolean[7][24]; // agenda.length = 7 and agenda[0].length = 24 char gender[ ] = {‘M’,’F’}; // initializations char team[ ][ ] = {{‘M’,’F’},{‘M’,’F’}}; collection[3] = 170; // accesses agenda[5][0] = true; Enumeration: enum Direction = {E,W,N,S}; // ex. of value: Direction.E collection[0] collection[1] collection[2] agenda[0][0] Agenda[0][1] agenda[1][0] Agenda[1][1] Syntax > Primitive entities
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Test unilateral: if (a<b) min=a; // if (<condition>) <action> Test bilateral: if (a>b) max = a; else max=b; // if (<condition>) <action> else <action>
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/13/2010 for the course COMPUTER S 6024 taught by Professor Mamadouk.traoré during the Spring '10 term at École Normale Supérieure.

Page1 / 36

Java - Foundations Application Programming Interfaces...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online