Carregar apresentação
A apresentação está carregando. Por favor, espere
PublicouVitória Affonso de Andrade Alterado mais de 8 anos atrás
1
© 2007 IBM Corporation Academic Initiative 07/05/07 Aula 2 – Parte 1: Java Basics Autores: Argemiro José de Limaajlima@br.ibm.com Juliano Marcos Martinsjulianom@br.ibm.com
2
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
3
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
4
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
5
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
6
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
7
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
8
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
9
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
10
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
11
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
12
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07 A cast is done by putting the name of the desired type (the result type) in parentheses before the value to be converted. An example of casting an int literal value to a byte: int i = 25; byte b = (byte) i; An example of casting a double literal value to an int: int i = (int) 25.123; // The resulting value of i is 25.
13
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07 Answers to the questions on the slide: 1.A char is basically an unsigned two-byte integer, while a short is a signed two-byte integer. Thus, char variables are capable of holding values that are outside of the range of a short. 2.12.35 has no “D” or “F” suffix, so it is assumed to be a double, not a float. It needs to be cast to a float, because it is a narrowing conversion.
14
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
15
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
16
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
17
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07 Javadoc tool generates HTML pages of documentation from the javadoc comments. Javadoc comments must start with /** and end with */ Special tags: Classes -@author, @version, @see (creates a “see also” reference) Methods -@param, @return, @exception, @see, @deprecated Fields -@see
18
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07
19
Programa de orientação em projetos de TI © 2003 IBM Corporation Academic Initiative 07/05/07 Details — Answers to checkpoint questions: 1.byte, short, int and long (char is not considered an integer, even though it is an Integral type). 2.float and double 3.A byte is a one-byte signed integer, a char is an unsigned two-byte value, typically used to hold a Unicode character. 4.When there is no danger of loss of precision. 5.Line comment (//), block comment (/* */) and javadoc comment (/** */). Javadoc comments may be used to later generate javadoc documentation; the other two types are used according to developer tastes.
Apresentações semelhantes
© 2024 SlidePlayer.com.br Inc.
All rights reserved.