Thursday, December 13, 2007

Notes on Java Fundamentals

Basic Lexical elements----
--->keywords & other reserved words

*******************************************************************
1. Access modifiers - private,public,protected
2.other modifiers---abstract,final,static,synchronized,transient, volatile
3 Name space keywords -- import,package

*******************************************************************
byte,short,int,long-- signed two's complement integers
boolean -- 1 bit
char-- 16 bit unicode characters rather than ASCII set used in C

********************************************************************
Formula ------2^(n-1) to 2^(n-1)-1`

********************************************************************

Exceptional Floating point constants---

Float.NAN
(NAN Stands for Not A Number)
Float.NEGATIVE_INFINITY
Float.POSITIVE_INFINITY
Double.NAN
Double.NEGATIVE_INFINITY
Double.POSITIVE_INFINITY

************************************************************************

char represented in single quotes -
'\u0000'--- followed by four hexadecimal

************************************************************************

Integral can be decimal, hexadecimal or octal
Hexadecimal starts with 0x
Octals start with 0

************************************************************************
Floating point e or E stands for exponential value
eg 7e3 =7000

*************************************************************************

note--> double x=77; is valid declaration as doublex =77D;

*************************************************************************

To convert boolean, characters,integers,floating point numbers to String use valueOf() method
String is not null terminated.

**************************************************************************

Once initialized string objects are inmutable i.e cannot change their contents. so use stringBuffer if the contents have to be changed.

****************************************************************************

String bounds checked at run time rather than compile time.

string abc ="sdefg";
is not same as
string abc =new("string");

if we use first one compiler scans current cache to check for another string object with same literal value.
If it is there it reuses same object.

********************************************************************************

Search Amazon for Best Books on Java J2EE

Blogarama

blogarama - the blog directory

Search your favourite topics

Google