What are the 'Java Standards' ???? 🤔

 

     Java Standards.

     Java ප්‍රධාන කොටස් 3කින් සමන්විත වන අතර එවා නම්,
  1. Class
  2. Method
  3. Variable      වේ.

සාමාන්‍යයෙන් අප Java  class එකකට  class name එකක්  ලබා දීමේදී.  මුල් අකුර Capital Letters වලින් තැබීම සිදුකරයි. එමගින්  අපට පහසුවෙන් class එකක් හදුනා ගත හැකිය. එමෙන්ම එහි පරාසය පෙන්වීමට අප { } Open / Close Brackets  ද, එම නමට ඉදිරියෙන් අප class යන Keyword එකද, ලබා දෙයි. 
 

             EX:- 
                        class Chamath { }
                        class Java { }

            
තවද අප Variable එකකට නමක් ලබා දීමේදී  සාමාන්‍යයෙන් සියලුම අකරු  Simple letters වලින් ලබා දේ.

              EX:- 
                        
                        String str;
                        String chamath;


එමෙන්ම Java Method එකකට නමක් ලබා දීමේදී සියලුම අකුරැSimple letters වලින් ලබාදෙන අතර අගට ( ) parameter එකක් ඇතුළත් කරයි. එමෙන්ම එහි පරාසය පෙන්වීමට අප { } open / close Brackets ද  භාවිතා කරයි.
                         

              EX:- 
                        
                        public void chamath(){

                        }   

    Object & Class

     What is an Object? 🤔 

Object එකක් යනු Properties සහ Behaviors  වල එකතුවකි. Object එකින් එකට Properties සහ Behaviors වෙනස් නොවන අතර එහි අගයන් පමණක් වෙනස් වේ.
 
              Ex:-    

 

              Object = Properties  + Behaviors

        

      What is a Class? 🤔

Class එකක් යනු Object එකක් සදහා සාදනු ලබන ආකෘතිය වේ.

 

   Human
   (Class)




                  EX-







   Object Generating

අපට Class එකක් තුළදී අවශ්‍ය තරම් Objects සදා ගත හැකිය.අපට එය ක්‍රම දෙකකට සිදු කළ හැකිය.
            
                        1) Human tharuka = new Human();

                        2) Human tharuka;
                            tharuka =  new Human;









      
        Ex-

            Human chamath = new Human();
            
            Car honda = new Car();

            Colour red = new Colour();



            Human chamath;
            chamath = new Human();


             Car honda;
             honda = new Car();

            
            Colour red;
             red= new Colour();

                

            
            
            



    

        

Comments

Popular posts from this blog

What are the 'Java Data Types' and 'Access Modifiers' ???? 🤔

Inheritance in java

Java Main Method and Construtor

Java Method Overloading

Abstraction in Java

Polymorphism

Encapsulation