![]() Still, for this article, all you need to know is that in OOPS, everything is considered as an object. ![]() If you want to get into details of OOPS concepts, go through with the above-given video, which I have embedded in this article previously. For example, get grades(float marks) that return a char, isRegular(String driverName) that returns a boolean, and so on. It is modular and reusable.įunction names in Java start with the small case, with the following words having the first letter as capital. The system, when divided into smaller functions, looks neat and is easy to understand. For example, applying the grade can be a function based on the marks. Such blocks of the system are called as functions. A string is an object.Ī lot of code that we write can be segregated into blocks of code so that many parts of the application can reuse it. For example, int has Integer boolean has Boolean, and so on. The data types char, int, float, boolean and double are called primitive types, and Java has corresponding objects for each of these. The limit of using a variable is defined by its scope, which can be local, static, or global. The advantage of storing data in variables is that we can use the variable anywhere in the code. Same way, since a boolean data type returns true or false, it is a good practice to name the variables starting with is, are, has, etc.… etc…) like the above and methods should start with a small case, and the following word begins with a capital letter – driver Name. One of the best practices in Java is to follow the right naming conventions. Java handles a lot of data types – String driverName Same way, the price of petrol that he puts in your vehicle is a floating-point (decimal). For example, the telephone number of your car driver is an integer, but his name is a string (array of characters). On a day to day basis, we come across different types of data. Now that we have a positive mindset and zing to learn let us look at all the concepts we need to learn to write efficient code in Java – Variables and data types
0 Comments
Leave a Reply. |