Professional Documents
Culture Documents
Oops PDF
Oops PDF
in Java
User defined data type cars
↓
No.
I
Roll
common
125
percentage
properties
Height
User defined data type
So students
Name -
String arr[so]
Roll No. -> int bor(so]
new data
type a student
Namte ↓
->
Roll No
percentage
Classes - creation
/Pet
name
-> data
X
type
creation
Objects - creation -
Student st new
= Student 1); At
S1
-
L
similar datatypes to store -
multiple
multiple attributes
eK esa objectcrate karna ho s
Scanner class yaad hai?
functions:
execlass to
·
We have to declare the class outside main.
·
Diff. package me class banai to?
at
values:
percent
public class Student [ pro,
-
int uno;
String name;
double percent;
3
S1-create
Access Modifiers
1) Public - all packages
2) Private - same class
3) Default - same package
Getters and Setters
-
↓
class
functions of a
private,
↓Y access
changes
“this” keyword
int
private uno;
3
What is a Constructor?
Student
->
percent
L
L
name
2nO
S1
Student new
=
Student ("Ragbar", 76,92.1);
What is final keyword ?
L
attribute
What is static keyword ?
Student 31 new
=
....
int uno;
#
SL
string name;
Student S2,
double percent;
53
int number ofstudents;
3
I
it
53
eno Name per
W
w St 76
Raghav 88.6
-
~ ~no name per
~
S2 67 Rahul 98.3
~
23
· I
·
2
03
static functions
d
Used if we want
to access a function in the class
+ -
7 =3
class Fraction [
2 I =
int num;
int den;
3
↓
Eadd(f2, f2);Simflify ();
sub (f1, f2)
Ques : Make Fraction class.
3-
Yet
d Fraction -1,
f2
21 %14
=
0 X
L
=
+1 f2 +3 ⑰
Ques : Make your own ArrayList.
1
Dynamic Array
3 size 4=
An
-> d3.
↓
ii)
11 I
arr. add()
aur,get()
THANK YOU
d
Maza Aagaya