Data Communication and Computer Networks
Data Communication and Computer Networks
JDK
JRE
JVM
• The Java platform differs from most other platforms in that it's a software only
platform that runs on top of other hardware-based platforms.
App.java
API
JVM
Data Types.
Byte - 8 bits.
Short - 16 bits.
Int - 32 bits.
Long - 64 bits.
Char - 16 bits.
Float - 32 bits.
Double - 64 bits.
Operators.
\t - Tab space
\b - Back space.
\n - New line.
\’ - Single Quotation.
\” - Double Quotations.
\\ - Backslash.
Garbage Collector.
When Java programs run on the JVM, objects are created on the heap, which is a portion of
memory dedicated to the program. Eventually, some objects will no longer be needed. The
garbage collector finds these unused objects and deletes them to free up memory.
Control Statements.
1. Sequential structure. - Default
2. Selection structure. - if – else, Switch case
3. Repetition structure. - while, do-while, for
Array
An array is a container object that holds a fixed number of values of a single type.
1st method
int [] Marks= { 60, 45, 65,94, 78,72,62,78,88};
2nd method
int Marks [] = new int [10] ;
// declares an array of integers and allocates memory for 10 integers
Marks [0] = 67;
// initialize first element
2D Array
1st method
int [][] Marks={ { 60, 45, 65,94}, {78,72,62,78,88} };
2nd method
int Marks [][] = new int [10][10] ;
// declares an array of integers and allocates memory for 10*10 integers
Marks [0][0] = 67;
// initialize first element
Identifiers.
An identifier is a word used by programmer to name a variable, method, class or label.
Must begin with – A letter, A dollar sign ‘$’, underscore ‘_’
Should not contain any java keywords.
Access Modifiers