Javabasics
Javabasics
Javabasics
softwares:
1)system:which software understandable by the machine lang
ex: O.S[DOS,WINDOWS,UNIX,LINUX,MAC...]
2)web
which application executed on multiple machines with internet.
ex: google,fb,amazon...etc
3)mobile:
which application executed on smartphone or tabs.
ex: whatsapp,instagram....etc
1)STANDALONE
2)WEB
3)MOBILE
1)high level
translators:
1)compiler=>all lines of code converted to machine
ex: c,c++,cobol
2)interpreter =>line by line code converted to machine
ex: html,css,jsc,python
FEATURES:
1)simple
2)oops
3)secured
4)portable
5)exception handling
6)dynamic
7)platform independent
8)compiler + interpreter
9) distributed
10)multi threading
java editions
1)J2SE: CORE JAVA
2)J2EE: ADV JAVA
3)J2ME: ANDROID
WWW.ORACLE.COM
|
DOWNDLOADS => JDK ON WINDOWS 10
[JVM+ JRE]
JAVA FUNDAMENTALS:
1)CHARSET:
ASCII CHARS=>0 TO 255[256]
A..Z(65...90),a..z(97...122),0...9(48...57),
#@$%... EACH CHAR 1 BYTE
UNICODE=>0 TO 65535[65536]
EACH CHAR 2 BYTES
2)KEYWORDS: WHICH WORDS ARE DEFINED BY AUTHORS.THESE WORDS USEr CAN'T MODIFY.
"RESERVERD WORDS"
IN JAVA TOTAL 50 KEYWORDS.
note:all keywords are lower case.
ex:
int,byte,short,long,float,double...
class,interface,abstract,final,..
try,catch,finally,final,finalize....
.........
3)variable:
which words are defined by users.
which can store the value in memory.
Every variable name defined with rules
1)Every variable name first letter starts with alphabet or underscore or dollor.
2)Every variable name in between special symbols not allowed except
underscrore,dollor.
3)Every variable name is case sensitive.
4)Every variable proceed with datatype.
5)keyword as a variable not allowed.
6)Every variable name must be unique name.
7)Every variable name recomanded meaningful or logical name.
8)Every variable name minimum 1 char length maximum no limit.
literal:
which value stored in variable that values are called as literals.
ex:
1)integer [int x=10]
2)float [float y=56.7f]
3)charcter [char z='a']
4)String [String city="surya"]
5)boolean [boolean fstatus=true]
identifier:
which is identified with specfic meaning.
ex: variable,classname,method...
statement:
A set of keywords or variables or literals make line is called as "statement"
ex:
int x,y,z;//declartion
x=10;//assignment
y=5;//assignment
z=x+y;//expression
program:
A set of statements is called as "program"
class A
{
public static void main(String[] args]
{
int x,y,z;//declartion
x=10;//assignment
y=5;//assignment
z=x+y;//expression
System.out.println(z);//outputstatement
}
}
java datatypes:
datatype:which type of information stored in variables.
1)primitive or built-in
2)nonprimitive or user defined or composite
1)primitive
a)integer[0..9]
in this user can store digits with out decimals,with out chars.
1)byte
syntax: byte variable;
memory: 1 byte[8 bits] [- 2 pow n-1 to + 2 pow n-1 -1]
range : - 2 pow 7 to + 2 pow 7 -1[-128 to +127]
ex: byte x;
x=10;[valid]
x=255;[invalid]
2)short
syntax:
short variable;
memory: 2 bytes[16 bits]
range: - 2 pow 15 to + 2 pow 15 -1[-32768 to + 32767]
ex: short x;
x=255;[valid]
x=45000;[invalid]
3)int
syntax: int variable;
memory : 4 bytes[32 bits]
range: - 2 pow 31 to + 2 pow 31 -1
ex: int sno;
sno=45000;[valid]
4)long
syntax: long variable;
memory:8 bytes[64 bits]
range: - 2 pow 63 to + 2 pow 63 -1
ex: long pages;
pages=100000;[valid]
int sno=10;
int sno='a';[invalid]
b)decimal:
number with decimal points.it is now allowed char datatypes.
1)float
syntax: float variable;
memory : 4 bytes[32 bits]
maximum points: .0000000[ 7 points]
exp range: -3.4 e po 318 to +3.4 e pow +318
ex:
float temp=45.56f;[valid]
float temp=45;[45.0]
2)double
syntax: double variable;
memory:8 bytes[64 bits]
max points:.00000..[15]
exp range : 1.7 e pow -314 to 1.7 e pow 318
ex:
double temp=56.8888765444;[valid]
c)charcter
In this datatype user store alpha and numeric data.
evey char enclosed in ' '
syntax:
char variable;
memory: ascii 1 byte
unicode 2 bytes
ex:char grade;
grade='a';[97-000111..][valid]
grade='1';[valid]
grade='+';[valid]
grade="123";[invalid]
String: A group of chars stored in single variable.
syntax: String variable;
ex: String city="hyd";//String is class in java.lang
d)boolean
in this datatype user can store boolean values either true or false
syntax: boolean datatype;
memory: 1 byte
values:true,false
ex:
boolean fstatus=true;
java operators:
operator:which can perform specific operation.
1)arthematic or mathematic:
+,-,*,/,%(mod)
ex:
a=10,b=3
c=a+b;[c=13]
d=a%b;[c=1]
2)assignment
(=)
ex:
x=10;
y=x;[y=10]
z=x+y-2;[z=18]
3)multiple assignment or compound
+=,-=,*=,/=,%=
ex:
x=4;
x+=2;//x=x+2 x=6
x-=3;//x=x-3 x=3
...
4)relational or comparison
>,<,>=,<=,==,!=
ex: x=10,y=5,z=10;
x>y[t]
x<y[f]
x==z[t]
x>=y[t]
x!=y[t]
5)logical
and(&&),or(||),not(!)