Day 2
Day 2
This keyword:
The this keyword refers to the current object in a method or constructor. The most
common use of the this keyword is to eliminate the confusion
between class attributes and parameters with the same name .
modifiers: private,protected,default,public.
non access modifiers: static, final ,abstarct,synchronized,transient.
**only final keywork is for only local modifiers.
private: a class cant be private,
private keyword can be used for data members,inner classes,methods.
private members accessed with in the class.
protected: it is same as class but members are accessed with in same package/
another package.
public: a class can be public , where name of the class same as source code file
name,accessible any where.
abstract classes:
it is used to set rules
an abstract keyword is used for method as wellas abstract class
**if any class extends abstract class then we have to override all abstract methods
else make the class as abstarct
**we cant create objects for abstarct classes.
EXCEPTION HANDLING:
types of errors:
compile time/syntax errors
logical errors/semantic
runtime erros/exception
arrays vs collections--->
arrays--- fixed size ,continuous memory similar datatype
collections---opposite to arrays.
map: collect elements in key value pairs
set:is unordered
list:elements are ordered.