java article 1
object and class
object
- properties and behaviour ඇති ඕනෑම දෙයක් object එකක් ලෙස හදුන්වයි.
Bread ,size , age, color → properties
eat, sleep, sit ,run → behavious
- object එකක properties(attributes) and behaviours(functionality) වලට අදාලව object එක class එක ලෙසද properties ,variable ලෙසද behaviours , method ලෙසද programming වලදී යොදා ගනී.
- එවිට object එකේ properties සහ behaviours පවතින ලෙසටම class එක තුල variable සහ method යොදා ගනී.
- එනම් එකක් class යනු යම් object එකකට අදාලව සාදා ගන්නා template එකකි. class එක තුල values පමනක් වෙනස් කර object ඕනෑ තරම් ප්රමානයක් ක්රියාත්මක කර ගත හැක.
java operator
1)" = " operator
- variable එකකට යමක් ආදේශ කිරීම සදහා යොදාගනි.
ex:-
String a="abcd";
2)" == " operator
- variable එකකට යමක් සමාන කිරීම සදහා යොදාගනි.
ex:-
int a==123;
3)"." operator
- calling කිරීම සදහා යොදාගනි.
ex:-
System.out.print("Hello world!");
4)";" operator
- code line ending කිරීම සදහා යොදාගනි.
ex:-
String a="Tree";
java standards
class hierarchy
1) Object
2) Class
3) Method
4) Variable
class එකක් හදුනා ගන්නේ කෙසේද?
👉1st letter එක uppercase එකක් නම් එය class එකකි.
ex:-
String
Text
Java
variable එකක් හදුනා ගන්නේ කෙසේද?
👉1st letter එක lowercase එකක් නම් එය variable එකකි.
ex:-
public
text
apple
Method එකක් හදුනා ගන්නේ කෙසේද?
👉1st letter එක lowercase එකක් වී එහි අවසානයෙදි parameter list එකක් යොදා ඇත්නම් එය එකකි.
ex:-
capital( )
text( )
apple( )





Comments
Post a Comment