Structure of a Java program
Greetings! I'm Vishnu Vinay, a Computer Science and Engineering graduate holding a B. Tech degree. Currently immersed in the captivating world of Artificial Intelligence, I am on a quest for knowledge while pursuing a graduate certificate in Artificial Intelligence with Machine Learning. My passion lies in sharing insights and discoveries in the fields of AI, Machine Learning, Artificial General Intelligence, and Robotics through engaging blog posts. Proficient in Python, ML libraries, and algorithms, I find joy in developing and deploying ML models, with a focus on leveraging AWS Sagemaker. Join me on this exciting journey of unraveling the mysteries of AI through the lens of coding, exploration, and the ever-evolving landscape of machine learning. Let's embark on this knowledge-sharing adventure together!
Explanation:
1) Packages - can consist of a set of classes.
2) Classes - contains a set of similar types of methods. A program can contain multiple classes. However, at least one of them should contain the main function but there are exceptions too.
3) Methods - are actually functions present inside classes, works exactly like functions which is a piece of code that can be used multiple times without writing them again and again. Implementing the DRY(Do Not Repeat) principle.
4) Properties/attributes - are simply variables associated with the class, which can be accessed or restricted in or out of a class depending on the access modifiers used.
5) object/instance of a class - a copy of the class.
Example:
Say you have a book with all the details on household workers consider it as a package.
Now there are different types of workers which can be an electrician, plumber, caretaker, babysitter and so on which can be considered classes.
These classes will contain all the details related to workers like his/her name, number and so on which can be considered attributes or properties.
Moving on, these classes will also contain details regarding how to contact them or schedule a time for repairing with them. These contents can be stored in the form of methods.
Finally, when it comes to accessing them we don't need to use the original one all we need is a copy and that copy is what we refer to as objects.
Some tips for naming conventions:
In the case of classes, follow the pascal case convention that is first letter must be capital then small and repeat the same rule for succeeding words (if the name contains more than 1 word). Eg:- PascalCaseConvention
In the case of packages, methods, attributes and objects, follow the camel case convention that is the first letter small and the succeeding words' first letter must be capitalized (if the name contains more than 1 word). Eg:- camelCaseConvention