Académique Documents
Professionnel Documents
Culture Documents
Language I
example:
char ch = X ;
Integer Types
// StringVsId.java
// contrast strings and identifiers
class StringVsId {
public static void main(String[] args) {
String hello = "Hello, world!";
String stringVary;
stringVary = hello;
System.out.println(stringVary);
stringVary = "hello";
System.out.println(stringVary);
}
}
Scope of variables
byte b;
int i = 257; // i = 257
(100000001)2
double d = 323.142; // 323 (101000011)2
b = (byte) i;
System.out.println(b); // b = 1
i = (int) d;
System.out.println(i); // i = 323
b = (byte) d;
System.out.println(b); // b = 67 (01000011)2
Arithmetic operations
Operation Symbol in C
Addition +
Subtraction -
Multiplication *
Division /
Remainder %
In Mathematics In C
a+b a+b
A-b A-b
ab a*b
ab a/g
Integer arithmetic