JAVA 6
JAVA 6
• If we try to store any other type of object in this ArrayList an error will
occur.
The Collections
Framework(ArrayList)
The Collections
Framework(ArrayList)
The Collections
Framework(ArrayList)
Exercise
• Write a Java program to create an array list, add some colors (strings)
and print out the collection.
Exercise
• Write a Java program to update an array element by the given
element.
Exercise
• Write a Java program to insert an element into the array list at the
first position.
What we learn..
• Basic syntax • Deconstructor
• Data types • OOP Concept
• Variables • Inheritance
• Operators • Polymorphism
• Comments • Overloading
• Access modifiers • Overriding
• Conditions • Encapsulation
• Loops • Abstraction
• Methods • Interfaces
• Object & Classes • Abstract Class
• Strings
• The Collections Framework
• Arrays
• Constructors
Quiz
• What do you mean by data encapsulation?
• Data Encapsulation is an Object-Oriented Programming concept of hiding the
data attributes and their behaviours in a single unit.
• It helps developers to follow modularity while developing software by ensuring
that each object is independent of other objects by having its own methods,
attributes, and functionalities.
• It is used for the security of the private properties of an object and hence serves
the purpose of data hiding.
Quiz
• Can you implement pointers in a Java Program?
• Pointers are a feature associated with the C programming language. They are
responsible for providing the memory address in a situation where the
programmer directly stores the data. But unfortunately, you won't find any
pointers in Java
Quiz
• what is the difference between final and const keyword in java?
• The main difference between const and final is that const can be considered as a
compile-time constant while final can be considered as a run-time constant
Quiz
• Different between heap and stack.
• Heap Space is used throughout the application, but Stack is only used for the
method — or methods — currently running. The Heap Space contains all objects
are created, but Stack contains any reference to those objects. Objects stored in
the Heap can be accessed throughout the application.
Quiz
• Can you call a constructor of a class inside another constructor?
• you can call one constructor from another constructor within the same class. This
process is known as constructor chaining, and the keyword this() is used to make
this call.
Assignment
• Write a Java programming to create a banking system with three
classes - Bank, Account, SavingsAccount, and CurrentAccount. The
bank should have a list of accounts and methods for adding them.
Accounts should be an interface with methods to deposit, withdraw,
calculate interest, and view balances. SavingsAccount and
CurrentAccount should implement the Account interface and have
their own unique methods.