Lecture 8
Upcoming SlideShare
Loading in...5
×
 

Lecture 8

on

  • 177 views

Notes on core java

Notes on core java
sub- OOPS

Statistics

Views

Total Views
177
Views on SlideShare
177
Embed Views
0

Actions

Likes
0
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Lecture 8 Lecture 8 Document Transcript

  • Core Java Debasish Pratihari Introduction to OOPs:  Object-oriented programming provides a superior way of organizing programming projects  It encourages a high degree of modularity in programming, making large projects easier to implement  It provides powerful techniques like inheritance and polymorphism to help organize and reuse code Features of OOPs:  Abstraction  Encapsulation  Inheritance  Polymorphism Procedural vs. Object-Oriented Programming :  The unit in procedural programming is function, and unit in object-oriented programming is class  Procedural programming concentrates on creating functions, while object-oriented programming starts from isolating the classes, and then look for the methods inside them.  Procedural programming separates the data of the program from the operations that manipulate the data, while object-oriented programming focus on both of them Lecture/core/oops1/08 Page #1 feel the Technology…
  • Core Java Debasish Pratihari Introduction to Class :  In object-oriented programming, a class is a programming language construct that is used as a blueprint or prototype to create objects.  it is an abstraction of a concept within a computer program.  It encapsulates state through data placeholders called member variables or fields; it encapsulates behavior through reusable code called methods or behavior.  A class has a constructor for creating objects Member of a class           Instance variable Class variable Local variable Instance method Class methods Constructors Initialization codec(Static code blocks) Finalize method Class (inner class) interface or non-static The Java Language Specification allows the followings:  Declare a class inside another class or inside an interface.  Declare an interface inside another interface or inside a class.  Declare a class inside a method.  Nest classes and interfaces declarations arbitrarily deep. Lecture/core/oops1/08 Page #2 feel the Technology…
  • Core Java Debasish Pratihari Declaring a class: Syntax : <class modifier> class <identifier>{ // Body here } Example: public class Laskhya{ //Body here } Access Modifiers:  Keywords that help to set the visibility, accessibility, or certain properties of a class, its member variables, and methods. Class Modifiers For Outer class     public abstract final strictfp For inner class  private  public  protected  abstract  final  strictfp Note: A class can’t be both final and abstract Field Declaration :  a type name followed by the field name, and optionally an initialization clause  field declarations can be preceded by different modifiers     Lecture/core/oops1/08 private public protected transient    volatile static final Page #3 Note: A field can’t be both final and volatile feel the Technology…
  • Core Java Debasish Pratihari Access control modifiers:  private: private members are accessible only in the class itself.  package: package members are accessible in classes in the same package and the class itself.  protected: protected members are accessible in classes in the same package, in subclasses of the class, and in the class itself.  public: public members are accessible anywhere the class is accessible. static modifier : 25%  only one copy of the static field exists, shared by all objects of this class  can be accessed directly in the class itself  access from outside the class must be preceded by the class name or via an object belonging to the class  from outside the class, non-static fields must be accessed through an object reference Final modifier :  once initialized, the value cannot be changed  often be used to define named constants  static final fields must be initialized when the class is initialized  non-static final fields must be initialized when an object of the class is constructed Lecture/core/oops1/08 Page #4 feel the Technology…