J & K STATE BOARD OF SCHOOL EDUCATION - JKBOSE
17 pages

J & K STATE BOARD OF SCHOOL EDUCATION - JKBOSE

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
17 pages
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

ROLL NAMESr J & K STATE BOARD OF SCHOOL EDUCATION E T T Annual 1ST Year Exam -2009-11 Result(Annual Reg) Notification No. -006 , Dated : 01/12/2011 Jammu Province) 1st Year Result Sr ROLL NAME 1st Year Result 101407 NAVEEN 1 Re(PPE,TLE) 101412 KASHMIR SINGH 2 Re(SPE,TLM,TLS,TLC,T LE,TLH,TPM,TPS,TPC,T PE,TPH,HPE) 101413 BALVINDER SINGH 3 Re(TLE) 101428 NEELAM DEVI 4 (Pass - 542) 101429 BLINDER SINGH 5 (Pass - 494) 101430 PRIYANKA 6
  • rehan khan
  • prasad kumhar
  • deep mala
  • assistant secretary
  • sr roll name
  • annual reg
  • -11 result

Sujets

Informations

Publié par
Nombre de lectures 98

Extrait

ComputerScienceIntroductoryCourseMSc-IntroductiontoJava
ComputerScienceIntroductoryCourseMSc- IntroductiontoJava Lecture2:ObjectOrientedProgramming
PabloOliveira <pablo@sifflez.org>
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava
Outline
1 References
2 Inheritance
3 Encapsulation
4 Polymorphism
5 Interfaces
6 Summary
TSNE
oCpmturecSeicnenIrtoudtcroyoCruesSMc-nIrtoudtcoinotaJav
Introduction:ObjectOrientedProgramming
Inthelastlecturewelearnedthatwecanstructureprogramsusing objectsofmanyclasses. InthislecturewewillexamineOOPconceptsinmoredetail: constructors: creatingnewobjects. references: designatingobjects. inheritance: creatingfamiliesofclasses. encapsulation: hidingimplementation. polymorphism: factorizingcommonbehaviours. interfaces: behavioralcontracts.
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava
Constructors:creatinganewobject
Definition Constructorsarespecialmethodsthatarecalledtocreateanewinstance oftheirclass.
class BankAccount { int balance; BankAccount() { balance=0; } BankAccount( int initialDeposit) { balance=initialDeposit; }
}
account1= new BankAcconut(); account2= new BankAccount(100);
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava References
Outline
1 References
2 Inheritance
3 Encapsulation
4 Polymorphism
5 Interfaces
6 Summary
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava References
References
Whenavariableisassignedaprimitivetypeitcontainsavalue. Whenassignedanobject,arrayorstring,itcontainsareferenceto thedata. Ifaiscopiedorpassed,oldandnewreferencespointtothe same originalobject .
staticvoid changeValues( int anArray[], int value) { anArray[0]=42; value=42; } publicstaticvoid main(Stringargs[]) { int v=0; int []a= { 0,0 } ; System.out.println(v++a[0]++a[1]); changeValues(a,v); System.out.println(v++a[0]++a[1]); } output: 0000240
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava References
Immutability
Stringareaspecialcase,becausetheyareimmutable(cannotbe changed). WhenyouchangeaStringanewdifferentStringiscreatedandthe charactersoftheorignalonearecopied. Forperformance:donotbuildastringwithconcatenation,use StringBuilder.
publicstaticvoid main(Stringargs[]) { Strings1=”hello”; Strings2=s1; s1=s1+”!”; System.out.println(s1++s2); }
output: hello!hello
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
Outline
1 References
2 Inheritance
3 Encapsulation
4 Polymorphism
5 Interfaces
6 Summary
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
Inheritance
Q:Rememberourturtle?Itcouldturnandadvance.Butwewantanew classCrabthatadvancessideways... WecouldwriteanewclassCrab,buttherewouldalotofcodein commonwithTurtle(whichmakesthecodebasedifficultto maintain). Wearegoingtouse inheritance . Inheritancemakesitpossibletocreatea subclass thatinheritsthe propertiesofitsancestoror superclass .
Animal
TurtleCrab
RedCrab
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
Inheritance
class Animal { Colorcolor; Positionposition; double rotation;
void turn( double angle) {} ; void advance() {} ; }
class Crab extends Animal { void advance() { / codeformovingsideways / }}
Crabcrab= new Crab(); crab.color=Color.BLUE; crab.advance();
superclass
subclass
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
overridingandhiding
Whatwejustdidwithmethodadvanceiscalled overriding . Whenwecall crab.advance() thecrab’sadvanceiscalled! Theanimal’sadvancehasbeenoverrided. Ifamethodisnotoverriden,thesuperclass’isused(here crab.turn(10); wouldcallAnimal’sturnimplementation. the final keywordinamethoddeclarationindicatesthatthe methodcannotbeoverridden. overridingastaticmethodoravariableiscalled hiding ,becausethenew staticimplementationorvariable hides theoldone,doingthisisusuallya badidea.
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
thisandsuper
foragivenclass this representsthecurrentclassand super the superclass. superisusedtocalloverridensuperclass’methods.
class Animal { void advance(); }
class Crab extends Animal { Stringname; advance() { this .turn(90); super .advance(); this .turn( 90); }}
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
class Animal { Positionposition; double rotation;
Animal(Positionposition, double rotation) { this .position=position; this .rotation=rotation; }
}
class Crab extends Animal { Stringname; Crab(Positionposition) { super (position,90); } Crab(Positionposition,Stringname) { this (position); this .name=name; }
}
InheritanceandConstructors
InjavaalltheclassesaresubclassesoftheObjectclass. Asubclassconstructorwillalwayscallasuperclassconstructor. Ifaclasspossessnoconstructor,anemptyonewithnoparameters isimplicit. Everyconstructorofasubclasscalltheno-parameterssuperclass constructor. Butwecancontrolthiswith super and this keywords.
Object()
RedCrab(Stringname)
Animal()
Crab()Crab(Stringname)
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
abstractmethods
Supposeweaddbirdstoourclasshierarchy. birdsandcrabsdonotmovethesameway...thereisnocommon implementationforadvancethatwecanputinAnimals. wecouldcreateanempty advance() inthe Animal classand overrideitin Bird and Crab . Yet,anotherprogramercouldaddanewsubclassandforgetto implementthe advance() method. Thus,weuse abstractmethods .
Definition
Anabstractmethodisamethodwhichhasnoimplementation. Anabstractclassisaclasswithabstractmethods. Itismandatoryforallthenon-abstractsubclassestooverrideallthe abstractmethods. Anabstractclasscannotbeinstantiated.
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Inheritance
abstractclass Animal { Positionposition; double rotation;
abstractvoid advance();
}
class Crab extends Animal { Stringname; void advance() { / crabmoves / }}
Animala= new Animal(); //COMPILATIONERROR Crabc= new Crab(); //Works!
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Encapsulation
Outline
1 References
2 Inheritance
3 Encapsulation
4 Polymorphism
5 Interfaces
6 Summary
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Encapsulation
Encapsulation
Definition Encapsulationistheactofhidingpropertiesandmethodsinsideaclass.
Thisallowstoprotectclassesfromunexpectedside-effectsfromthe outside. Italsoenforcesimplementationagnosticprogramming,whichisa goodidea.
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Encapsulation
Packages
Definition A package isagroupofclasses. Packagesdefinea namespace . Classesinthesamepackagesharethesame namespace .
package Animals; class Animal {} class Crab {}
import Animals.Crab; import Animals. ; class MyProgram {}
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Encapsulation
Accesmodifiers
Injavaencapsultationisobtainedthroughacces/visibilitymodifiers . Classescanbe public ,visiblebyeveryone or withoutmodifier inwhichcasetheyareonlyvisibleinsidetheir package(agroupofclasses). Classmembers(variablesandmethods)canhave4modifierswith differentdegreesofvisibility.
ModierClassPackageSubclassWorld publicYYYY protectedYYYN nomodierYYNN privateYNNN
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Encapsulation
packagesanimals; class Animal { privatedouble rotation; publicvoid turn( double angle) { position+=angle; } } class Crab extends Animal { publicvoid turnBack() { turn(180); //legal rotation+=180; //illegal }}
ComputerScienceIntroductoryCourseMSc-IntroductiontoJava Polymorphism
Outline
1 References
2 Inheritance
3 Encapsulation
4 Polymorphism
5 Interfaces
6 Summary
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents