Carl is a hedgehog. Yes that is it, Carl is a hedgehog for more information on Carl contact https://github.com/vaishnav04 But instead if you want to know more Java Keep Reading and Enjoy ๐
Object oriented programing is used for expressing real-world objects in programming concepts like objects and classes and also to take advantage of features like
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Classes | Objects |
---|---|
A Class is a template or blueprint from which objects are created | An Object is an instance of a class |
A Class is declared once | An Object can be created anynumber of times |
Class does not allocate memory when it is created | An Object takes up memory when they are created |
Inheritance is the property by which a class or an object can acquires all the properties of the Parent class or object.
Polymorphism means performing a task in different ways. There are two types of Polymorphism in java
- Compile-time Polymorphism
- Run-time Polymorphism
Abstraction is the process of hiding the implementation of a class from a user and only shows the required data.
The process of wrapping up of the code into a single unit is called Encapsulation.
While naming Classes it is always recomeneded to start with capital letter. Nouns are given the names for Classes and it should be an apropriate word rather than acronyms.
While naming Interfaces it should always start with capital letter. It should always be an adjective and should be an aproprate word rather than an acronym.
While naming Methods it should always start with small letter. It should alwaus be a verb.If it contains more than one world the starting of the second word could be Capitalized. example: actionPerformed()
Variable names should always start with small letters. There should not be any special characters while naming a variable. Naming a variable as x,y,z is not recommended it is better to use something like name, address etc....
Pacakage names should be lowercase words and each word should be seperated by a dot(.).
Constants should be named in all caps, example PI. If there are more than one word it is recommended to use and _ to seperate them example THE_VALUE_OF_PI.