Commit 93afb834 authored by LiniEisha's avatar LiniEisha

Demo (for pp2) changes

parent bd82963e
today our lecture is based an introduction to Object Oriented Programming Concepts before going to that lets focus on a few things specific to java In java there are 8 primitive types of data they are byte short int long char float double and boolean from these long int short and byte are integer data types Double and float are float data type unlike languages like C plus plus the sizes of integers floats are fixed and are platform neutral characters this group includes char which represents symbols in a character set like letters and numbers boolean this group includes boolean which is a special type for representing true or false values declaring Objects in Java is a two step process. First, you must declare a variable of the class type this variable does not define an object instead it is simply a variable that can refer to an object second you must use the new operator to dynamically allocates that is, allocates at run time memory for an object and returns a reference to it this reference is more or less the address in memory of the object allocated by new another main thing you need to know is static modifiers they indicates that the attributes and methods are common to all the object in the whole class rather than to an individual object a static method does not operate on an object following are the most commonly used attributes and methods ystem dot out System dot in Math.PI Integer dot parse Int Character dot is Letter There will be times when you will want to define a class member that will be used independently of any object of that class when a member is declared static it can be accessed before any objects of its class are created, and without reference to any object You can declare both methods and variables to be static The most common example of a static member is main is declared as static because it must be called before any objects exist instance variables declared as static are essentially global variables When objects of its class are declared no copy of a static variable is made instead all instances of the class share the same static variable methods declared as static have several restrictions they can only directly call other static methods they can only directly access static data they cannot refer to this or super in any way next important thing is overloading and overriding We will talk about these two separately in another lecture so just for now know that overriding occurs in inheritance when a descendant class replaces a method with the same signature and overloading occurs when there are methods with different signatures now lets move on to our topic object oriented programming what is object oriented programming object oriented programming is a programming concept that works on the principles the main principles are abstraction encapsulation inheritance and polymorphism oop allows users to create the objects that they want and then, create methods to handle those objects the basic concept of oops is to create objects reuse them throughout the program and manipulate these objects to get results object oriented programming popularly known as oop is used in a modern programming language like java students your 1st assignment will be in next week based on core oop concepts now lets what are core oop concepts first one is class the class is a group of similar entities it is only an logical component which means it is not a physical entity now lets go for example if you had a class called expensive cars the object could be like mercedes bmw toyota etc and the properties an be price or speed of these cars while the methods may be performed with these cars are driving reverse braking next core concept is object An object can be defined as an instance of a class and there can be multiple instances of a class in a program an Object contains both the data and the function which operates on the data For example chair bike marker pen table next we have Inheritance what is inheritance inheritance is an oop concept in which one object acquires the properties and behaviours of the parent object error
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment