The document discusses object-oriented programming concepts in Java such as inheritance, polymorphism, abstraction, and encapsulation. It defines inheritance as extending existing classes and reusing their properties to create new classes. There are different types of inheritance like single, multilevel, hierarchical, and multiple inheritance using interfaces. The document also discusses access modifiers, abstract classes and methods, interfaces, packages, and other OOP concepts in Java.
The document provides an overview of a course on Java and data structures. It discusses Java's history and origins as an object-oriented language influenced by C and C++. It then outlines the course syllabus which covers core Java concepts, object-oriented principles, exceptions, I/O streams, and various data structures like arrays, stacks, queues, linked lists, trees, graphs and their algorithms. The document concludes with discussing tools like JDK needed for the course and recommended textbooks.
Exception handling in Java allows programs to gracefully deal with errors and unexpected conditions. There are two types of exceptions: checked exceptions which must be explicitly caught, and unchecked exceptions which do not need to be caught. The try-catch block is used to catch exceptions, where code that might throw an exception is placed in the try block and catch blocks handle specific exceptions. Finally blocks are always executed and can be used to perform cleanup tasks. Exceptions can also be explicitly thrown using the throw keyword or declared as thrown from methods using the throws clause.
The document discusses classes and methods in Java. It defines that a class is a user-defined data type that serves as a template to define properties. A class contains fields to store data and methods to perform actions. Methods are declared inside the class and can access and modify the class fields. The document also discusses creating objects from classes using the new keyword, using constructors to initialize objects, using this keyword to refer to class fields from methods, method overloading and static methods.
This document discusses Java data types and variables. It begins by defining data types as sets of values with predefined characteristics. It then lists the default Java primitive data types (boolean, char, byte, short, int, long, float, double) along with their default sizes and values. Examples are provided to demonstrate the double and char data types. The document then discusses variables, describing how to declare them and the three types: local, instance, and static variables. It also covers dynamic initialization, default values, and visibility/scope. Finally, the document discusses type conversion and casting between incompatible types in Java.
This document provides an overview of the basics of Java. It discusses that Java is an object-oriented programming language derived from C and C++. It was originally developed by Sun Microsystems in 1991 under the name Oak but was renamed to Java in 1995. The document outlines the history and development of Java, and describes how Java programs can create both applications and applets. It also summarizes some of the key differences between Java and C++. Finally, it provides a high-level overview of the main features of Java including being simple, object-oriented, platform independent, secure, robust, architecture neutral, portable, dynamic, interpreted, high performance, multi-threaded, and distributed.
The document discusses multithreading in Java. It defines a thread as the smallest unit of processing and describes how Java allows executing multiple threads simultaneously. It outlines the five states in a thread's lifecycle and how threads transition between these states. It also discusses how to create threads by extending the Thread class or implementing the Runnable interface. Additionally, it covers common thread methods like sleep(), join(), getName(), currentThread(), and setting priority. The document concludes with a brief overview of synchronization in Java.
The document introduces algorithms and data structures. It defines an algorithm as a collection of unambiguous instructions to solve a problem in a finite number of steps. Examples of algorithms provided include ones to calculate the sum of numbers, determine if a number is even or odd, sort elements, and calculate factorials. The document then discusses analyzing the efficiency of algorithms using time and space complexity. Common data structures like arrays, stacks, queues, linked lists, graphs, trees, tables and sets are described along with their basic operations. Asymptotic notations to describe an algorithm's time complexity such as Big O, Omega and Theta notation are also introduced.
- Java uses streams to perform input and output operations which allow for fast processing. Streams are sequences of data composed of bytes.
- The main stream classes in Java are InputStream for reading data and OutputStream for writing data. These classes handle byte-oriented input/output.
- FileInputStream and FileOutputStream classes allow reading and writing of data to files by extending InputStream and OutputStream respectively. They are used for file handling operations in Java.
The document provides an overview of a course on Java and data structures. It discusses Java's history and origins as an object-oriented language influenced by C and C++. It then outlines the course syllabus which covers core Java concepts, object-oriented principles, exceptions, I/O streams, and various data structures like arrays, stacks, queues, linked lists, trees, graphs and their algorithms. The document concludes with discussing tools like JDK needed for the course and recommended textbooks.
Exception handling in Java allows programs to gracefully deal with errors and unexpected conditions. There are two types of exceptions: checked exceptions which must be explicitly caught, and unchecked exceptions which do not need to be caught. The try-catch block is used to catch exceptions, where code that might throw an exception is placed in the try block and catch blocks handle specific exceptions. Finally blocks are always executed and can be used to perform cleanup tasks. Exceptions can also be explicitly thrown using the throw keyword or declared as thrown from methods using the throws clause.
The document discusses classes and methods in Java. It defines that a class is a user-defined data type that serves as a template to define properties. A class contains fields to store data and methods to perform actions. Methods are declared inside the class and can access and modify the class fields. The document also discusses creating objects from classes using the new keyword, using constructors to initialize objects, using this keyword to refer to class fields from methods, method overloading and static methods.
This document discusses Java data types and variables. It begins by defining data types as sets of values with predefined characteristics. It then lists the default Java primitive data types (boolean, char, byte, short, int, long, float, double) along with their default sizes and values. Examples are provided to demonstrate the double and char data types. The document then discusses variables, describing how to declare them and the three types: local, instance, and static variables. It also covers dynamic initialization, default values, and visibility/scope. Finally, the document discusses type conversion and casting between incompatible types in Java.
This document provides an overview of the basics of Java. It discusses that Java is an object-oriented programming language derived from C and C++. It was originally developed by Sun Microsystems in 1991 under the name Oak but was renamed to Java in 1995. The document outlines the history and development of Java, and describes how Java programs can create both applications and applets. It also summarizes some of the key differences between Java and C++. Finally, it provides a high-level overview of the main features of Java including being simple, object-oriented, platform independent, secure, robust, architecture neutral, portable, dynamic, interpreted, high performance, multi-threaded, and distributed.
The document discusses multithreading in Java. It defines a thread as the smallest unit of processing and describes how Java allows executing multiple threads simultaneously. It outlines the five states in a thread's lifecycle and how threads transition between these states. It also discusses how to create threads by extending the Thread class or implementing the Runnable interface. Additionally, it covers common thread methods like sleep(), join(), getName(), currentThread(), and setting priority. The document concludes with a brief overview of synchronization in Java.
The document introduces algorithms and data structures. It defines an algorithm as a collection of unambiguous instructions to solve a problem in a finite number of steps. Examples of algorithms provided include ones to calculate the sum of numbers, determine if a number is even or odd, sort elements, and calculate factorials. The document then discusses analyzing the efficiency of algorithms using time and space complexity. Common data structures like arrays, stacks, queues, linked lists, graphs, trees, tables and sets are described along with their basic operations. Asymptotic notations to describe an algorithm's time complexity such as Big O, Omega and Theta notation are also introduced.
- Java uses streams to perform input and output operations which allow for fast processing. Streams are sequences of data composed of bytes.
- The main stream classes in Java are InputStream for reading data and OutputStream for writing data. These classes handle byte-oriented input/output.
- FileInputStream and FileOutputStream classes allow reading and writing of data to files by extending InputStream and OutputStream respectively. They are used for file handling operations in Java.
This document discusses Java strings and string-related concepts in Java. It covers:
- How strings are implemented as objects in Java
- Creating strings using literals vs. the new keyword
- Common string methods like length(), charAt(), equals(), etc.
- Immutability of strings in Java
- Comparing strings using equals(), ==, and compareTo()
- String concatenation and splitting
- The StringBuffer class for mutable strings
- The StringTokenizer class for breaking strings into tokens
The document provides examples and explanations of key string-related topics in Java like object creation, comparison, mutability, and common methods. It aims to give an overview of working with strings as a
The document provides an introduction to the Standard Template Library (STL) in C++. It discusses that STL introduces templates, containers and algorithms that help develop complex programs. The key STL components include containers to store data, iterators to access data, and algorithms to manipulate data. It describes common STL containers like vectors, lists, maps that allow storing and organizing data. It also explains common container functions and algorithms like sort, find and merge that can be used to process container data.
A queue is a linear data structure that follows a first-in first-out (FIFO) principle. Elements are inserted at the rear end and deleted from the front end. There are two main operations for a queue - enqueue, which inserts an element at the rear, and dequeue, which removes an element from the front. A queue can be implemented using an array, with front and rear pointers indicating the first and last elements. Circular queues improve on this by allowing the queue to loop from the end to the beginning of the array when the rear reaches the end. The document provides algorithms for enqueue, dequeue, and their circular variants. It also lists job scheduling as an application of queues.
This document discusses keywords in Java including this, super, and final. It explains that this refers to the current object instance and is used to call methods or access fields of the current class. Super is used to call methods or access fields of the parent class. Final is used to declare variables that cannot be reassigned, prevent method overriding, and prevent class inheritance. The document also covers static keywords and how static methods can be called on a class without creating an instance.
This document discusses methods, constructors, and interfaces in Java programming. It defines methods as constructs that group statements together to perform a function. Methods can return values or be void. Constructors are special methods used to initialize objects, and must have the same name as the class. Interfaces contain abstract method signatures that classes implement, allowing for multiple inheritance. The document provides examples of defining methods, constructors, abstract classes, and implementing interfaces in Java code.
The document discusses the static keyword in Java and its uses for variables, methods, blocks and nested classes. It explains that static members belong to the class rather than instances, and provides examples of static variables, methods, blocks and how they work. Key points include static variables having only one copy in memory and being shared across instances, static methods that can be called without an instance, and static blocks that initialize static fields when the class loads.
This document provides an overview of object-oriented programming concepts including classes, objects, inheritance, abstraction, encapsulation, and polymorphism. It defines OOP as an engineering approach for building software systems based on modeling real-world entities as classes and objects that exchange messages. Key concepts are explained such as classes defining attributes and behaviors of objects, objects being instances of classes, and communication between objects occurring through messages. The four main principles of OOP - inheritance, abstraction, encapsulation, and polymorphism - are also summarized.
OOPS Concepts, Java Evolution, Class Object basic, Class Object Constructor overloading, Inheritance, Array and String, Final Abstract class and interfaces, Exceptions, Streams, GUI Applications, Applet Programming, Network Programming and Java Sockets, Multi Threading
This document provides an overview of Java basics including keywords, data types, variables, and constants. It discusses object-oriented programming concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also describes the primitive data types in Java like integer, floating-point, character, and boolean types. Finally, it covers identifiers, keywords, constants, and variables in Java.
The document discusses inheritance in Java programming. It defines inheritance as an is-a relationship between a superclass and subclasses, where subclasses inherit and extend the functionality of the superclass. The document covers key inheritance concepts like method overriding, where subclasses can define their own implementation of a method from the superclass, and method overloading, where classes can define multiple methods with the same name but different parameters. It also discusses dynamic method dispatch, where Java determines which version of an overridden method to call based on the object type at runtime.
The document discusses inheritance in Java. It defines key terminology like superclass, subclass, reusability and the extends keyword. It provides examples of single inheritance with an Employee and Programmer class, and multilevel inheritance with an Animal, Dog and BabyDog class. It also covers method overriding, where a subclass provides its own implementation of a method in the superclass. Dynamic method dispatch is explained, where the version of an overridden method that is executed depends on the object type, not the reference variable type. The document concludes with an overview of method overloading.
Inheritance allows reuse of properties and behaviors of an existing class when creating new classes. The existing class is called the base/parent class, while the new class is the derived/child class. The child class inherits all properties and behaviors of the parent class and can define additional properties and behaviors of its own. There are different types of inheritance like single, multilevel, multiple and hierarchical inheritance which define how properties and behaviors are inherited between parent and child classes.
This document discusses inheritance in Java programming. It defines inheritance as an "is-a" relationship between a superclass and subclass where the subclass is a more specific version of the superclass. The key concepts covered are method overloading, which allows methods to perform different tasks based on parameters; method overriding, which provides different implementations of methods in subclasses; and dynamic method dispatch, which determines which version of an overridden method to execute based on the object type at runtime.
This document discusses inheritance in Java programming. It defines inheritance as an "is-a" relationship between a superclass and subclass where the subclass is a more specific version of the superclass. The key concepts covered include method overloading, where methods can have the same name but different signatures; method overriding, where subclasses can provide their own implementation of a method in the superclass; and dynamic method dispatch, which determines which version of an overridden method to call at runtime based on the object type.
- Java uses classes and objects to organize code and data. A class defines the blueprint for an object and can contain attributes and methods.
- To create a class, use the "class" keyword followed by the class name. Objects are instances of classes and are created using the "new" keyword.
- The basic structure of a Java program includes creating a class, writing a main method with the public static void signature, and using print statements to output text. Command line arguments can be passed into the main method.
- Inheritance allows classes to inherit and extend the functionality of other classes. Subclasses inherit attributes and behaviors from their parent superclass. This supports code reuse and method overriding for polymorphism.
Inheritance is a mechanism in Java that allows one class to acquire the properties (fields and methods) of another class. The class that inherits is called the subclass, and the class being inherited from is called the superclass. This allows code reuse and establishes an is-a relationship between classes. There are three main types of inheritance in Java: single, multilevel, and hierarchical. Method overriding and dynamic method dispatch allow subclasses to provide their own implementation of methods defined in the superclass.
This document discusses inheritance in object oriented programming. It covers key concepts of inheritance including derived classes inheriting behavior and attributes from base classes to promote code reuse. Specific topics covered include is-a relationships between classes, access control of inherited members, continuous inheritance where derived classes can act as base classes, and examples of inheritance hierarchies.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.
The document discusses inheritance in object-oriented programming. It defines inheritance as a mechanism where a subclass inherits properties and behaviors from its parent superclass. The key points are:
- A subclass inherits attributes and methods from its superclass. The subclass can also define its own attributes and methods or override existing superclass methods.
- There are two types of inheritance - single inheritance where a subclass inherits from one superclass, and multiple inheritance which is not supported in Java.
- Access modifiers like public, private, protected determine which members of the superclass are accessible to subclasses. Private members cannot be accessed by subclasses.
- The extends keyword is used to create a subclass that inherits from an existing superclass. The subclass inherits all non
- The document discusses polymorphism and pointers in C++. It defines polymorphism as a technique that allows different forms of a single function to be defined and shared among various objects.
- Pointers store memory addresses and can be used to manipulate objects and inherit from base classes. Virtual functions allow functions to be called polymorphically based on the object's type through a base class pointer.
- Examples are provided to demonstrate pointer declaration, manipulation, inheritance, and virtual functions to achieve runtime polymorphism. Abstract base classes with pure virtual functions are also introduced.
This document discusses Java strings and string-related concepts in Java. It covers:
- How strings are implemented as objects in Java
- Creating strings using literals vs. the new keyword
- Common string methods like length(), charAt(), equals(), etc.
- Immutability of strings in Java
- Comparing strings using equals(), ==, and compareTo()
- String concatenation and splitting
- The StringBuffer class for mutable strings
- The StringTokenizer class for breaking strings into tokens
The document provides examples and explanations of key string-related topics in Java like object creation, comparison, mutability, and common methods. It aims to give an overview of working with strings as a
The document provides an introduction to the Standard Template Library (STL) in C++. It discusses that STL introduces templates, containers and algorithms that help develop complex programs. The key STL components include containers to store data, iterators to access data, and algorithms to manipulate data. It describes common STL containers like vectors, lists, maps that allow storing and organizing data. It also explains common container functions and algorithms like sort, find and merge that can be used to process container data.
A queue is a linear data structure that follows a first-in first-out (FIFO) principle. Elements are inserted at the rear end and deleted from the front end. There are two main operations for a queue - enqueue, which inserts an element at the rear, and dequeue, which removes an element from the front. A queue can be implemented using an array, with front and rear pointers indicating the first and last elements. Circular queues improve on this by allowing the queue to loop from the end to the beginning of the array when the rear reaches the end. The document provides algorithms for enqueue, dequeue, and their circular variants. It also lists job scheduling as an application of queues.
This document discusses keywords in Java including this, super, and final. It explains that this refers to the current object instance and is used to call methods or access fields of the current class. Super is used to call methods or access fields of the parent class. Final is used to declare variables that cannot be reassigned, prevent method overriding, and prevent class inheritance. The document also covers static keywords and how static methods can be called on a class without creating an instance.
This document discusses methods, constructors, and interfaces in Java programming. It defines methods as constructs that group statements together to perform a function. Methods can return values or be void. Constructors are special methods used to initialize objects, and must have the same name as the class. Interfaces contain abstract method signatures that classes implement, allowing for multiple inheritance. The document provides examples of defining methods, constructors, abstract classes, and implementing interfaces in Java code.
The document discusses the static keyword in Java and its uses for variables, methods, blocks and nested classes. It explains that static members belong to the class rather than instances, and provides examples of static variables, methods, blocks and how they work. Key points include static variables having only one copy in memory and being shared across instances, static methods that can be called without an instance, and static blocks that initialize static fields when the class loads.
This document provides an overview of object-oriented programming concepts including classes, objects, inheritance, abstraction, encapsulation, and polymorphism. It defines OOP as an engineering approach for building software systems based on modeling real-world entities as classes and objects that exchange messages. Key concepts are explained such as classes defining attributes and behaviors of objects, objects being instances of classes, and communication between objects occurring through messages. The four main principles of OOP - inheritance, abstraction, encapsulation, and polymorphism - are also summarized.
OOPS Concepts, Java Evolution, Class Object basic, Class Object Constructor overloading, Inheritance, Array and String, Final Abstract class and interfaces, Exceptions, Streams, GUI Applications, Applet Programming, Network Programming and Java Sockets, Multi Threading
This document provides an overview of Java basics including keywords, data types, variables, and constants. It discusses object-oriented programming concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also describes the primitive data types in Java like integer, floating-point, character, and boolean types. Finally, it covers identifiers, keywords, constants, and variables in Java.
The document discusses inheritance in Java programming. It defines inheritance as an is-a relationship between a superclass and subclasses, where subclasses inherit and extend the functionality of the superclass. The document covers key inheritance concepts like method overriding, where subclasses can define their own implementation of a method from the superclass, and method overloading, where classes can define multiple methods with the same name but different parameters. It also discusses dynamic method dispatch, where Java determines which version of an overridden method to call based on the object type at runtime.
The document discusses inheritance in Java. It defines key terminology like superclass, subclass, reusability and the extends keyword. It provides examples of single inheritance with an Employee and Programmer class, and multilevel inheritance with an Animal, Dog and BabyDog class. It also covers method overriding, where a subclass provides its own implementation of a method in the superclass. Dynamic method dispatch is explained, where the version of an overridden method that is executed depends on the object type, not the reference variable type. The document concludes with an overview of method overloading.
Inheritance allows reuse of properties and behaviors of an existing class when creating new classes. The existing class is called the base/parent class, while the new class is the derived/child class. The child class inherits all properties and behaviors of the parent class and can define additional properties and behaviors of its own. There are different types of inheritance like single, multilevel, multiple and hierarchical inheritance which define how properties and behaviors are inherited between parent and child classes.
This document discusses inheritance in Java programming. It defines inheritance as an "is-a" relationship between a superclass and subclass where the subclass is a more specific version of the superclass. The key concepts covered are method overloading, which allows methods to perform different tasks based on parameters; method overriding, which provides different implementations of methods in subclasses; and dynamic method dispatch, which determines which version of an overridden method to execute based on the object type at runtime.
This document discusses inheritance in Java programming. It defines inheritance as an "is-a" relationship between a superclass and subclass where the subclass is a more specific version of the superclass. The key concepts covered include method overloading, where methods can have the same name but different signatures; method overriding, where subclasses can provide their own implementation of a method in the superclass; and dynamic method dispatch, which determines which version of an overridden method to call at runtime based on the object type.
- Java uses classes and objects to organize code and data. A class defines the blueprint for an object and can contain attributes and methods.
- To create a class, use the "class" keyword followed by the class name. Objects are instances of classes and are created using the "new" keyword.
- The basic structure of a Java program includes creating a class, writing a main method with the public static void signature, and using print statements to output text. Command line arguments can be passed into the main method.
- Inheritance allows classes to inherit and extend the functionality of other classes. Subclasses inherit attributes and behaviors from their parent superclass. This supports code reuse and method overriding for polymorphism.
Inheritance is a mechanism in Java that allows one class to acquire the properties (fields and methods) of another class. The class that inherits is called the subclass, and the class being inherited from is called the superclass. This allows code reuse and establishes an is-a relationship between classes. There are three main types of inheritance in Java: single, multilevel, and hierarchical. Method overriding and dynamic method dispatch allow subclasses to provide their own implementation of methods defined in the superclass.
This document discusses inheritance in object oriented programming. It covers key concepts of inheritance including derived classes inheriting behavior and attributes from base classes to promote code reuse. Specific topics covered include is-a relationships between classes, access control of inherited members, continuous inheritance where derived classes can act as base classes, and examples of inheritance hierarchies.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.
The document discusses inheritance in object-oriented programming. It defines inheritance as a mechanism where a subclass inherits properties and behaviors from its parent superclass. The key points are:
- A subclass inherits attributes and methods from its superclass. The subclass can also define its own attributes and methods or override existing superclass methods.
- There are two types of inheritance - single inheritance where a subclass inherits from one superclass, and multiple inheritance which is not supported in Java.
- Access modifiers like public, private, protected determine which members of the superclass are accessible to subclasses. Private members cannot be accessed by subclasses.
- The extends keyword is used to create a subclass that inherits from an existing superclass. The subclass inherits all non
- The document discusses polymorphism and pointers in C++. It defines polymorphism as a technique that allows different forms of a single function to be defined and shared among various objects.
- Pointers store memory addresses and can be used to manipulate objects and inherit from base classes. Virtual functions allow functions to be called polymorphically based on the object's type through a base class pointer.
- Examples are provided to demonstrate pointer declaration, manipulation, inheritance, and virtual functions to achieve runtime polymorphism. Abstract base classes with pure virtual functions are also introduced.
The document discusses objects and classes in Java. It defines a class as a template for creating objects with common properties and behaviors. A class contains fields to store data and methods to perform actions on that data. The document uses the Circle class as an example, defining fields like radius and center coordinates, and methods like circumference() and area(). It explains how to define classes, create objects from classes using the new keyword, access object fields and methods, and use nested classes, inner classes, local classes and anonymous classes in Java.
This document discusses keywords in Java including this, super, and final. It explains that this refers to the current object instance and is used to call methods or access fields of the current class. Super is used to call methods or access fields of the parent class. Final is used to declare variables that cannot be reassigned, prevent method overriding, and prevent class inheritance. The document also covers static keywords and how static methods can be called on a class without creating an instance.
The document discusses access modifiers in Java. There are four access modifiers: public, private, protected, and default. Public members are accessible everywhere, private only within the class, protected within subclasses and the package, and default only within the package. The document demonstrates how to use access modifiers with attributes and methods, including using getter and setter methods to access private attributes from other classes.
java include many development tools, classes and methods. java in computer help you for coding purpose.inheritance also shown in java slideshow java is architecture neutral types of inheritance also base class and its derived class
This document provides an overview of Java fundamentals including classes, objects, encapsulation, abstraction, inheritance, polymorphism and other core OOP concepts. Key points covered include:
- Classes contain variable declarations and method definitions while objects have state, behavior and identity.
- Encapsulation is achieved by declaring class variables as private and providing public get and set methods.
- Abstraction hides certain details and shows only essential information to the user using abstract classes and interfaces.
- Inheritance allows classes to extend functionality from other classes in a hierarchical manner to achieve code reuse.
- Polymorphism allows a single action to be performed in different ways depending on the object used.
This document discusses classes in Java. It covers defining a class, the elements of a class like methods and variables, memory allocation for classes, coding standards, access modifiers, encapsulation, inner classes, and examples. Key topics include how everything in Java is treated as an object, classes providing meaning to objects, and classes having logical but not physical existence until objects are created from them.
Similar to 5. Inheritances, Packages and Intefaces (20)
The document discusses linked lists, which are a linear collection of data nodes linked together by pointers. Each node contains a data field and a pointer to the next node. Linked lists allow for efficient insertion and removal of nodes while using less memory than arrays. Common linked list operations like traversing, searching, and inserting/deleting nodes at different positions are demonstrated through pseudocode algorithms. Applications mentioned include representing polynomials with linked lists.
The document discusses stacks and their implementation and applications. It defines a stack as a list of elements where elements can only be inserted or removed from one end, called the top. Stacks can be implemented using arrays, with a pointer tracking the top element. The key operations on a stack are push to add an element, pop to remove an element, and peek to access the top element. The document provides algorithms for these operations and discusses applications of stacks like recursion, infix to postfix conversion, and postfix to infix conversion. It includes an example of converting an infix expression to postfix using a stack.
The document discusses arrays and various operations that can be performed on arrays including traversing, searching, insertion, deletion, and sorting. It defines linear arrays as lists of homogeneous data elements of a finite number and describes different ways of representing arrays using subscripts, Fortran notation, and Pascal notation. The document also provides algorithms for traversing, inserting, deleting, linear searching, binary searching, and different sorting methods like bubble sort, insertion sort, and selection sort.
The document discusses templates in C++. It explains that templates allow functions and classes to work with different data types using a single code definition. Template functions are called function templates, and template classes are called class templates. The document provides examples of defining class and function templates, and overloading template functions. It demonstrates how templates can be used to create generic functions that operate on multiple types of data.
The document discusses file handling in C++ using object oriented programming. It covers key concepts like opening and closing files, reading and writing to files, file pointers, error handling and random access operations. Classes like ifstream, ofstream and fstream are used for input, output and input/output file operations. Functions like open(), close(), get(), put(), read(), write(), seekg(), seekp() etc. are used to perform various file operations.
This document discusses input and output in C++. It explains that C++ uses stream classes to implement input/output operations with the console and disk files. It describes the different stream classes like istream, ostream, and iostream. It discusses unformatted I/O functions like cin, cout, get(), put(), getline(), and write() for console input/output. It also covers formatted I/O functions like width(), precision(), fill(), and setf() to control formatting of output.
This document provides an overview of string manipulation in C++. It discusses C-style strings and introduces C++ strings as objects of the string class. It describes various string constructors, functions for comparison, concatenation, insertion, extraction and other operations. Examples are given to demonstrate the use of functions like length(), capacity(), empty(), at(), find(), assign(), begin() and end(). The document is intended as a lecture on object-oriented string handling in C++.
Operator overloading allows user-defined types in C++ to behave similarly to built-in types when operators are used on them. It allows operators to have special meanings depending on the context. Some key points made in the document include:
- Operator overloading enhances the extensibility of C++ by allowing user-defined types to work with operators like addition, subtraction, etc.
- Common operators that can be overloaded include arithmetic operators, increment/decrement, input/output, function call, and subscript operators.
- To overload an operator, a member or friend function is declared with the same name as the operator being overloaded. This function performs the desired operation on the class type.
-
The document discusses classes and objects in object-oriented programming. It defines what a class is, how classes are declared with public and private members, and how objects are instantiated from classes. It also describes defining member functions inside and outside of classes, and the use of static class members and friend functions.
C++ is an object-oriented programming language developed by Bjarne Stroustrup at Bell Labs as an extension of C with the addition of classes. A simple C++ program consists of including header files, defining classes and their functions, and a main function that uses the classes. The program demonstrates input using cin and output using cout to display the sum and average of two numbers entered by the user.
An overview of object oriented programming including the differences between OOP and the traditional structural approach, definitions of class and objects, and an easy coding example in C++. This presentation includes visual aids to make the concepts easier to understand.
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
1. Derived conceptsDerived concepts
By
Nilesh Dalvi
Lecturer, Patkar-Varde College.Lecturer, Patkar-Varde College.
http://www.slideshare.net/nileshdalvi01
Java and Data StructuresJava and Data Structures
2. Inheritance
• Inheritance is one of the most useful and essential
characteristics of oops.
• Existing classes are main components of
inheritance.
• New classes are created from existing one.
• Properties of existing classes are simply extended
to the new classes.
• New classes are called as derived classes and
existing one are base classes.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
4. Types of Inheritance
Single inheritance:
A derived class with only one base class is
called as single inheritance.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
5. Types of Inheritance
Multilevel inheritance:
The mechanism of deriving a class from
another ‘derived class’ is known as multilevel
inheritance.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
6. Types of Inheritance
Hierarchical inheritance:
One class may be inherited by more than one
class. This process is known as hierarchical
inheritance.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
7. Types of Inheritance
Hybrid inheritance:
It is combination of Hierarchical and Multilevel
inheritance.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
8. Types of Inheritance
Multiple inheritance (Interfaces):
A derived class with several base classes is
called as Multiple inheritance.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
9. Defining Sub class
• A Sub class can be defined by specifying its relationship with
the super class in addition to its own details.
class sub-class-name extends super-class-name
{
//members of sub class.
}
• The extends indicates that the properties of super class are
extended to the sub class.
• Sub class contain its own properties as well as those of the
super class.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
10. Visibility Control
• It is also known as access modifiers.
• Java provides:
– Public access
– Friendly access (Default)
– Protected access
– Private access
– Private protected access
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
11. Visibility Control
Public access:
• Any variable or method is visible to the entire
class in which it is defined.
• But, to make a member accessible outside
with objects, we simply declare the variable or
method as public.
• A variable or method declared as public has
the widest possible visibility and accessible
everywhere.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
12. Visibility Control
Friendly access:
• When no access modifier is specified, the member
defaults to a limited version of public accessibility
known as "friendly" level of access.
• The difference between the "public" access and the
"friendly" access is that the public modifier makes
fields visible in all classes, regardless of their
packages while the friendly access makes fields
visible only in the same package, but not in other
packages.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
13. Visibility Control
Protected access:
• The visibility level of a "protected" field lies in
between the public access and friendly access.
• That is, the protected modifier makes the fields
visible not only to all classes and subclasses in the
same package but also to subclasses in other
packages
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
14. Visibility Control
Private access:
• Private fields have the highest degree of protection.
• They are accessible only with their own class.
• They cannot be inherited by subclasses and
therefore not accessible in subclasses.
• Method declared as private behaves like final
method .
• It prevents the method from being sub classed.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
15. Visibility Control
Private protected access:
• A field can be declared with two
keywords private and protected together.
Eg. private protected int codeNumber;
• This gives a visibility level in between the "protected"
access and "private" access.
• This modifier makes the fields visible in all subclasses
regardless of what package they are in.
• Remember, these fields are not accessible by other
classes in the same package.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
17. Single inheritance
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Room
{
int length;
int breadth;
Room (int x, int y)
{
length = x;
breadth = y;
}
int area ()
{
return(length * breadth);
}
}
18. Single inheritance
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class BedRoom extends Room
{
int heigth;
BedRoom(int x, int y, int z)
{
super (x, y);
height = z;
}
int volume ()
{
return (length * breadth * height);
}
}
19. Single inheritance
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class IntDemo
{
public static void main(String args [])
{
BedRoom b = new BedRoom(14, 12, 10);
System.out.println("Area :" + b.area());
System.out.println("Volume :" + b.volume());
}
}
20. super keyword
• The super is a reference variable that is used
to refer immediate parent class object.
• Usage of super Keyword
– super is used to refer immediate parent class
instance variable.
– super() is used to invoke immediate parent class
constructor.
– super is used to invoke immediate parent class
method.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
21. super keyword
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
//refer immediate parent class instance variable.
class Vehicle
{
int speed = 50;
}
class Bike extends Vehicle
{
int speed = 100;
void display()
{
System.out.println(super.speed);
}
public static void main(String args[])
{
Bike b=new Bike();
b.display();
}
}
22. super keyword
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
//invoke parent class constructor.
class Vehicle
{
Vehicle()
{
System.out.println("Vehicle is created");
}
}
class Bike extends Vehicle
{
Bike()
{
super();//will invoke parent class constructor
System.out.println("Bike is created");
}
public static void main(String args[])
{
Bike b=new Bike();
}
}
23. super keyword
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
// super can be used to invoke parent class method.
class Person
{
void message(){
System.out.println("welcome");
}
}
class Student extends Person
{
void message(){
System.out.println("welcome to java");
}
void display(){
message();
super.message();
}
public static void main(String args[]){
Student s=new Student();
s.display();
}
}
24. Method Overriding
• If subclass (child class) has the same method as declared in
the parent class, it is known as method overriding.
• Advantage of Java Method Overriding
– Method Overriding is used to provide specific implementation of a
method that is already provided by its super class.
– Method Overriding is used for Runtime Polymorphism
• Rules for Method Overriding
– method must have same name as in the parent class
– method must have same parameter as in the parent class.
– must be IS-A relationship (inheritance).
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
25. Method Overriding
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Vehicle
{
void run()
{
System.out.println("Vehicle is running");
}
}
class Bike extends Vehicle
{
void run()
{
System.out.println("Bike is running safely");
}
public static void main(String args[])
{
Bike obj = new Bike();
obj.run();
}
}
26. final keyword
• It is used to restrict the user.
• The final keyword can be used in many context.
• Final can be:
– Variable
– Method
– class
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
27. final Variable
• If you make any variable as final, you cannot change
the value of final variable(It will be constant).
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Bike
{
final int speedlimit=90;
void run()
{
speedlimit=400;
}
public static void main(String args[])
{
Bike obj=new Bike();
obj.run();
}
}
28. final Method
• If you make any method as final, you cannot override
it.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Bike
{
final void run() {
System.out.println("running");
}
}
class Honda extends Bike
{
void run() {
System.out.println("running safely
with 100kmph");
}
public static void main(String args[]){
Honda honda= new Honda();
honda.run();
}
}
29. final Class
• If you make any class as final, you cannot extend it.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
final class Bike{}
class Honda extends Bike
{
void run()
{
System.out.println("running safely
with 100kmph");
}
public static void main(String args[])
{
Honda honda= new Honda();
honda.run();
}
}
30. Abstract Modifier
• It is applied to
– Class
– Method
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
31. Abstract Class
• An abstract class never be instantiated.
• If a class is declared as abstract then, the sole purpose is for
the class to be extended.
• A class can not both final and abstract.
• If class contain abstract method, the class should be declared
abstract otherwise compile time error thrown.
• Abstract class may contain both abstract and normal
methods.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
abstract class shape
{
-----------
-----------
abstract void draw();
-----------
}
32. Abstract Method
• It is a method declared without any implementation .
• Method body provided by sub class
• Never be final
• Any class that extends abstract class must implement all the
abstract method of super class, unless the subclass is also an
abstract class.
• The abstract method ends with semicolon.
• Example: public abstract sample();
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Rectangle extends shape
{
void draw(){
------
}
}
33. Abstract Class
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
abstract class Media
{
protected String title;
protected float price;
media(String s, float p)
{
title = s;
price = p;
}
abstract void display();
}
34. Abstract Class
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Book extends Media
{
protected int pgs;
Book(String s, float p, int p)
{
title = s;
price = p;
pgs = p;
}
void display ()
{
System.out.println("Title :"+ title);
System.out.println("Pages :"+ pgs);
System.out.println("Price :"+ price);
}
}
35. Abstract Class
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class Tape extends Media
{
protected int time;
Book(String s, float p, int t)
{
title = s;
price = p;
time = t;
}
void display ()
{
System.out.println("Title :"+ title);
System.out.println("Duration :"+ time);
System.out.println("Price :"+ price);
}
}
36. Abstract Class
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
class AbstractMain
{
public static void main(String args [])
{
Media book = new Book("ABC", 100, 20);
Media tape = new Tape("XYZ", 100, 20);
book.display();
tape.display();
}
}
37. Finalizer Method
• Constructor is used to initialize an object when it is declared,
process is known as initialization.
• Java supports a concept of finalization.
• JRE automatically frees up the memory recourses used y the
objects.
• But object may hold non-object resources such as window
system fonts and file descriptor.
• Garbage collector cannot be free these resources in order to
free these we must use a finalizer method.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
finalize(){
//
}
38. Interfaces: Multiple inheritance
• An interface is basically kind of class
• Like classes interfaces contains methods and
variable but with major difference
• It defines only abstract methods and final fields
• Do not specifies any code to implement these
methods and data fields contain only constants.
• Its responsibility of the class that implements an
interface to define the code for implementation
of these methods.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
39. Defining interface
interface interface-name // implicitly abstract
{
variable declaration; // implicitly public
methods declaration; // implicitly abstract, public
}
• Example:
interface Item // implicitly abstract
{
static final int code = 1001;
static final String name = “Fan”;
void display();
}
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
40. Difference between class & Interface
• Members of interface are always constant i.e. their
values are final.
• Methods in interface are abstract in nature i.e. no
code associated with it.
• An interface never be instantiated, it can only
inherited by a class.
• It can only use public access specifier.
• An interface is not extended by a class; it is
implemented by a class.
• An interface can extend multiple interfaces.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
41. Extending interfaces
interface name2 extends name1
{
//body of name2
}
• Example:
interface ItemConstants
{
static final int code = 1001;
static final String name = “Fan”;
}
interface Item extends ItemConstants
{
void display();
}
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
42. Implementing interfaces
class class-name implements interface-name
{
//body of class-name
}
• More general form:
class class-name extends super-class implements interface-name
{
//body of class-name
}
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
44. Packages
• A package is a collection of similar types of classes,
interfaces and sub-packages.
• Package in java can be categorized in two form,
built-in package and user-defined package.
• Since package acts as the library which is shared by
the many people.
• Standard Java library is distributed over the number
of packages, including :
– java.lang
– java.util
– java.net and so on.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
46. Creating packages
package mypack;// package declaration
public class class-name1
{
body of class-name
}
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
47. Using package
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
import mypack.*;
class class-name2 extends class-name1
{
body of class-name2
}