Sei sulla pagina 1di 3

Java 6::

JVM executes and compiles byte code that is developed by java compiler
two JVM are present in java. One for client and another for server -
Default one is client.
to use specific JVM we can mention -server or -client after java in command
java -client -> this will use client JVM
java -server
Javah -> we can call C language code from Java using this
javap -> java decompiler
Super();-> constructor lo first statement adi untundhi..oka vela manam rayaka po
yina adi default ga call avuthundhi
inkoti Super()-> ee method construtor lo first line ayyi undali. lekhapothey adi
error
inkoti-> general ga konni super class la lo construtor protected ga untundhi ->
so ilanti construtors ni kevalam extend chesukunna class nunchi mathramey call c
heyagalugutham
Static -> general ga java code compile cheyyalantey first manam code rayali..tha
ruvatha dhanni compile cheyyali so appudu .class file generate avuthundhi
oka sari .class file generate ayyaka dhanni run cheseytappudu adi memory loki lo
ad avuthundhi..once load ayyey time lo oka blue print thayaru chesukuntundhi..ep
pudanna edhanna aa class ki object create chesukuntey okokka object create chest
hundhi..so incase class lo oka variable x untey, inka manam aa class ki 4 object
s create chesthey 4 memories create avuthayi. prathi dhantlo x varible untundhi.
.ipuudu oka vela adi static variable avuthey adi blueprint lo untundhi but not i
n each object.. so manam x ni refere chesthey appudu aa varible blue print nunch
i vasthundhi not from memory created for each object
Normal ga prathi method in java blueprint lo ne unthundhi..so oka vela edhina ob
ject method ni use chesukovalantey appudu blue print dagara unna reference
all executable code remains with class defination antey blueprint dhaggara annam
ata..executable code antey methods ani..kani varible mathram objects lo untayi a
nd prathi istance sambandhinchina varibles dhani dhaggarey unnatayi..dheniki exc
eption static varibles...
suppose oka class lo oka method undhi.. aa class blueprint lo ee method untundhi
..eppudu aa class ni 4 times initialize chesamu..so 4 objects data create ayyi u
ntundhi..ee objects lo kevalam non static variablees mathramey untayi no methods
..methods motham blue print lo untayi..oka vela edhina object method ni call che
sthey adi blue print lo unna method ki velthundhi..oka vela ee call chesina obje
ct thana reference pampakuntey ..this aney varible lo automatic ga set ayyiuntun
dhi kada dhanni blue print upayoginchukoni execute chesthundhi..so class A blue
print lo display aney method undhi ani anukundham.. now A ki a1,a2,a3 objects ni
create chesam..now display method code kevalam blue print dhaggara mathramey un
tundhi..no a1.display ani call chesthey adhi A blueprint ki velli andhuo unna me
thod ni call chesthundhi..but dheniki this antey a1 reference pothundhi..so edhi
na display method lo variableni use chesthey this.varible antey a1 ki sambandhin
china object lo undey aa variableni pilusthundhi..ee this ni pass cheyadamu defa
ult ga jaruguthundhi..java vallu ala rasaru
oka vela aa method static avuthey//appudu this avasaram ledhu..class name okkati
enough....so this anedhi pass kadhu
import statements
8 things that import use for ::
1-> full name of class ne thelusukogalam - java.util.ArrayList ->fullname
2-> this is not written in class - edi em chesthadhi antey compiler ki full name
s chepthundhi..manam prgram lo use chesedhi mathram short name..class lo manam f
ull name tho represent chesthey import statements ignore cheyyochu
3-> java.io.* ->ekkada * anedhi regular expression kadhu..* is a place where sho
rtname will be inserted to give full name
compiler em chesthadhi antey edhina class name resolve kakapothey appudu * unna
place lo aa class name petti try chesthundhi
4-> import statements compil time lo mathrame ..classnames ni resolve chesukodan
iki mathramey upayogistharu
5-> java.lang.* default
6-> final static imports - you can directly import the methods using import of s
tatic class ..Ex Byte class lo valueOf aney method undhi ..so if we import java.
lang.Byte.valueOf; appudu x=valueOf("1000"); ani use cheyyochu..so import valla
aa method direct ga scope loki vachesthundhi
Generics::
java modhati versions lo manam data ni Object class loki rasey laga prepare ches
aru
Generics ->casting that works at compile time-> casting cheyakunda okey wrapper
class multiple different type object ni save chesukodaniki generics use chesharu
wrapper class -> edhina class single object ni thesukoni dhaniki setters and get
ters kaligi untey dhanni wrapper class antaru
Generics endhuku avasaram appadayantey ::
java 1 image choodu andhlo class stash anedhi wrapper class..stashone aney new c
lass string object ni save cheyyadaniki String data ni object lo petti dhanni wr
apper pampindhi..wrapper nunchi thesukuney tappudu adhi string lo ki type cast c
heyyalsochindhi..
ela kakgudadhantey java 2 image choosthey wrapper lo object kakunda string undhi
..so type case cheyalsina avsaram ledhu..kani stash class String ki bind ipoyind
hi antey string kakunda inkendhi pampadaniki ledhu..
ee problem ni arikattdaniki generics vadutharu..
generics emantey source class loki etuvanti class nina pampiyocha ..alane edhina
class ni retrive chesukunteppudu dhanni typecast cheyalsina vasaram ledhu..
so casting automatic ga compile time lo ne jarigipodaniki manam dhenni use chest
ham
Ex::
class Source<T>
{
T t;
set(T x)
{
t=x;
}
T get()
{
return t;
}
class mainclass
{
Source<String> s1 = new Source<String>();
s1.set("Sandeep");
String newString=s1.get();
Source<Integer> s1 = new Source<Integer>();
s1.set("10");
int newint=s1.get();
}
Generics cast check is happened at compile time not at runtime..ela wrapper clas
s lo generic cheyadani type erraser antaru
Generics naming conventions::
Parameters - single capital letter
Generics - manam generics class lakey kakunda methods ki kuda upayoginchagalam
java 4 image lo gentype method ki elanti parameter ina pass cheyochu..edhina met
hod generic ga untey dhani method defination lo generic value place cheyyali
public <T> gentype(T t)
{
sysout(t.getName());
}
alagey objtype method kuda gentype laney pani chesthundhi..kani dif emantey prat
hiclass ki super class ina object ni pampam anthey..dhenilo type casting jarugut
hundhi
java5 imagelo::
source class raseytapudu manam
class stash <T extends Number> -> e satatement em antey Number class yokka subcl
asses anni generic ga pass cheyyochu
java6 image lo ..single source class lo mutiple classes ni generic ga execute ch
esav...
Collections::
for(Object o:collection)
{
print o.string();
}
pina una code for tho rasaru incase dhanni while lo rayalantey manam iterator ni
upayoginchali
Iterator<?> it=collection.iterator();
while(it.hasNext())
{
Object o=it.next();
print o.string();
}
iterator purpose traversing -- 3 methods -- hasNEXT, NEXT,REMOVE

Potrebbero piacerti anche