November+11th+by+Doris+Xue

= AP Computer Science A : Chapter 1 =

Packges and Classes

 * 1) A Package can be defined as a **grouping of related types** (classes, interfaces, enumerations and annotations ) providing access protection and namespace management.
 * 2) Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier, etc.
 * 3) Import a package；
 * 4) If a class wants to use another class in the same package, the package name need not be used. Classes in the same package find each other without any special syntax.
 * 5) All java methods must be contained in a class, and all program statements must be placed inside a method.
 * 6) public: Public means a class or method is usable outside of the class, whereas private data members or methods.
 * 7) **Static**: Static means that the variable or method marked as such is avaliable at the class level. In other words, you don't need to create a instatance of the class to access it.
 * 8) Void: Void means the reaturn value of this is Null.

Identifiers

 * 1) Identifiers are the names of variables, methods, classes, packages and interfaces. Unlike literals they are not the things themselves, just ways of referring to them. In the HelloWorld program, HelloWorld, String, args, main and println are identifiers.
 * 2) Identifiers must be composed of letters, numbers, the underscore _ and the dollar sign $. Identifiers may only begin with a letter, the underscore or a dollar sign.
 * 1) Over flow error: try to store a value whose magnitude is too big in a variable.
 * 2) A varuable is often initialized in its declarations

Storage of numbers

Hexadecimal and Octal Numbers
 * 1) Decimal Number System: Decimal number system has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, called digits. It uses positional notation. That is, the least-significant digit (right-most digit) is of the order of 10^0 (units or ones), the second right-most digit is of the order of 10^1(tens), the third right-most digit is of the order of 10^2 (hundreds), and so on.
 * 2) Binary Number System: Binary number system has two symbols: 0 and 1, called bits. It is also a positional notation. binary digit is called a bit. Eight bits is called a byte.
 * 3) Hexadecimal number system uses 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, called hex digits. Each hexadecimal digit is also called a hex digit. Most programming languages accept lowercase 'a' to 'f' as well as uppercase 'A' to 'F'.Computers uses binary system in their internal operations, as they are built from binary digital electronic components. However, writing or reading a long sequence of binary bits is cumbersome and error-prone. Hexadecimal system is used as a compact form or shorthand for binary bits. Each hex digit is equivalent to 4 binary bits
 * 4) A link about how to store a negative number in computer:

Operators Arithmetic Operators: Relational Operators: Logical Operators: Assignment Operators: code format="java" public class Test {
 * 1) - Subtraction operator
 * 2) * Multiplication operator
 * 3) / Division operator
 * 4) % Remainder operator
 * 1) == Equal to
 * 2) != Not equal to
 * 3) > Greater than
 * 4) >= Greater than or equal to
 * 5) < Less than
 * 6) <= Less than or equal to
 * 1) && Conditional-AND
 * || Conditional-OR
 * 1) ! Conditional-NOT

public static void main(String args[]) { int a = 10; int b = 20; int c = 0;

c = a + b;     System.out.println("c = a + b = " + c );

c += a ; System.out.println("c += a = " + c );

c -= a ; System.out.println("c -= a = " + c );

c *= a ; System.out.println("c *= a = " + c );

a = 10; c = 15; c /= a ; System.out.println("c /= a = " + c );

a = 10; c = 15; c %= a ; System.out.println("c %= a = " + c );

c <<= 2 ; System.out.println("c <<= 2 = " + c );

c >>= 2 ; System.out.println("c >>= 2 = " + c );

c >>= 2 ; System.out.println("c >>= 2 = " + c );

c &= a ; System.out.println("c &= a = " + c );

c ^= a ; System.out.println("c ^= a  = " + c );

c |= a ; System.out.println("c |= a  = " + c ); } } code Output: code format="java" c = a + b = 30 c += a = 40 c -= a = 30 c *= a = 300 c /= a = 1 c %= a = 5 c <<= 2 = 20 c >>= 2 = 5 c >>= 2 = 1 c &= a = 0 c ^= a  = 10 c |= a  = 10 code Increment and Decrement Operators:
 * 1) ++ i ++ i is incremented by 1
 * 2) -- i -- i is decremented by 1

>

=(´･_･`) Have a good day~=