×
WORK HARD UNTIL LAMP LIGHT OF STUDY TABLE BECOMES SPOT LIGHT OF STAGE.
--Your friends at LectureNotes
Close

Java Programming

by Jntu Heroes
Type: NoteInstitute: Jawaharlal nehru technological university anantapur college of engineering Offline Downloads: 128Views: 2079Uploaded: 10 months agoAdd to Favourite

Share it with your friends

Suggested Materials

Leave your Comments

Contributors

Jntu Heroes
Jntu Heroes
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LECTURE NOTES ON JAVA COURSE CODE : A40503 BRANCH/YEAR : CSE/II SEMESTER : II 1
Syllabus UNIT I: OOP concepts- Data abstraction- encapsulation- inheritance- benefits of inheritancepolymorphism-classes and objects- procedural and object oriented programming paradigm. Java programming – History of java- comments data types-variables-constants-scope and life time of variables-operators-operator hierarchy-expressions-type conversion and castingenumerated types- control flow – block scope- conditional statements-loops-break and continue statements- simple java stand alone programs-arrays-console input and output- formatting output-constructors-methods-parameter passing- static fields and methods- access control- this reference- overloading methods and constructors-recursion-garbage collection- building stringsexploring string class. UNIT II: Inheritance – Inheritance hierarchies- super and subclasses- member access rules- super keyword- preventing inheritance: final classes and methods- the object class and its methods Polymorphism – dynamic binding- method overriding- abstract classes and methods Interface – Interfaces VS Abstract classes- defining an interface- implement interfacesaccessing implementations through interface references- extending interface. Inner classes – Uses of inner classes- local inner classes- anonymous inner classes- static inner classes- examples. Packages – Defining- creating and accessing a package- understanding CLASSPATHimporting packages. UNIT III: Exception Handling – Dealing with errors- benefits of exception handling- the classification of exceptions – exception hierarchy- checked exceptions and unchecked exceptions- usage of trycatch-throw-throws and finally-rethrowing exceptions- exception specification- built in exceptions- creating own exception sub classes. Multithreading – Differences between multiple processes and multiple threads- thread statescreating threads- interrupting threads- thread priorities- synchronizing threads- inter – thread communication- producer consumer pattern UNIT I V: Collection Framework in java – Introduction to java collections- overview of java collection frame work-generics-commonly used collection classes- Array List- vector -hash table-stackenumeration-iterator-string tokenizer -random -scanner -calendar and properties Files – streams – byte streams- character stream- text input/output- binary input/output- random access file operations- file management using file class. Connecting to Database – JDBC Type 1 to 4 drivers- connecting to a database- querying a database and processing the results- updating data with JDBC. UNIT V GUI Programming with Java – The AWT class hierarchy- introduction to swing- swing Vs AWT-hierarchy for swing components- containers- JFrame-JApplet-JDialog-Jpanel-overview of some swing components – JButton-JLabel- JTextField-JTextArea- java lab course description 2
simple applications- Layout management – Layout manager types – border- grid and flow Event Handling: Events- Event sources- Event classes- Event Listeners- Relationship between Event sources and Listeners- Delegation event model- Example: handling a button clickhandling mouse events- Adapter classes. Applets – Inheritance hierarchy for applets- differences between applets and applications- life cycle of an applet- passing parameters to applets- applet security issues. TEXT BOOK: Java Fundamentals – A comprehensive Introduction- Herbert Schildt and Dale Skrien REFERENCES 1. Java for programmers-P.J.Dietel and H.M.Dietel Pearson education(or)Java: How to program P.J.Dietel and H.M.Dietel-PHI 2. Object Oriented programming through Java -P.Radha Krishna -Universities Press 3. Thinking in Java- Bruce Eckel-Pearson Education 4. Programming in Java- S.Malhotra and S. Choudhary- Oxford University Press. UNIT-1 Topics: OOP concepts- Data abstraction- encapsulation- inheritance- benefits of inheritancepolymorphism-classes and objects- procedural and object oriented programming paradigm. Java programming – History of java- comments data types-variables-constants-scope and life time of variables-operators-operator hierarchy-expressions-type conversion and castingenumerated types- control flow – block scope- conditional statements-loops-break and continue statements- simple java stand alone programs-arrays-console input and output- formatting output-constructors-methods-parameter passing- static fields and methods- access control- this reference- overloading methods and constructors-recursion-garbage collection- building stringsexploring string class. 3
Introduction Everywhere you look in the real world you see objects—people, animals, plants, cars, planes, buildings, computers and so on. Humans think in terms of objects. Telephones, houses, traffic lights, microwave ovens and water coolers are just a few more objects. Computer programs, such as the Java programs you’ll read in this book and the ones you’ll write, are composed of lots of interacting software objects. We sometimes divide objects into two categories: animate and inanimate. Animate objects are ―alive‖ in some sense—they move around and do things. Inanimate objects, on the other hand, do not move on their own .Objects of both types, however, have some things in common. They all have attributes (e.g., size, shape, color and weight), and they all exhibit behaviors (e.g., a ball rolls, bounces, inflates and deflates; a baby cries, sleep crawls, walks and blinks; a car accelerates, brakes and turns; a towel absorbs water). We will study the kinds of attributes and behaviors that software objects have. Humans learn about existing objects by studying their attributes and observing their behaviors. Different objects can have similar attributes and can exhibit similar behaviors. Comparisons can be made, for example, between babies and adults and between humans and chimpanzees. Object-oriented design provides a natural and intuitive way to view the software design process—namely, modeling objects by their attributes and behaviors just as we describe real-world objects. OOD also models communication between objects. Just as people send messages to one another (e.g., a sergeant commands a soldier to stand at attention), objects also communicate via messages. A bank account object may receive a message to decrease its balance by a certain amount because the customer has withdrawn that amount of money. Object-Oriented: Although influenced by its predecessors, Java was not designed to be source-code compatible with any other language. This allowed the Java team the freedom to design with a blank slate. One outcome of this was a clean, usable, pragmatic approach to objects. Borrowing liberally from many seminal object-software environments of the last few decades, Java manages to strike a balance between the purist’s ―everything is an object‖ paradigm and the pragmatist’s ―stay out of my way‖ model. The object model in Java is simple and easy to extend, while simple types, such as integers, are kept as high-performance nonobjects. OOD encapsulates (i.e., wraps) attributes and operations (behaviors) into objects, an object’s attributes and operations are intimately tied together. Objects have the property of information hiding. This means that objects may know how to communicate with one another across well-defined interfaces, but normally they are not allowed to know how other objects are implemented ,implementation details are hidden within the objects themselves. We can drive a car effectively, for instance, without knowing the details of how engines, transmissions, brakes and exhaust systems work internally—as long as we know how to use the accelerator pedal, the brake pedal, the wheel and so on. Information hiding, as we will see, is crucial to good software engineering. 4

Lecture Notes