Posts

Explanation of public static void main in Java

Image
 In java , we have encountered a most common syntax many times which is something like this- We all have written this code when we are first introduced with java. But , most of us are unaware about what this codes says. What is the use of public static void main() and why it is always written like this , no matter how much the length of code. Its format is still the same. Lets try to understand this one by one - public - This public keyword is an access modifier. Now , what access modifier is ? It is used to help to know who can access the method or variable. There are 4 types of access modifiers - public , protected, private and default. This main method is declared as public so that we JVM can invoke it outside of the class and evryone can access it to provide output. If it is changed to any other modifier then JVM would not be able to access it and main method will not invoked by it causing error that - main class not found. static-  It is also a keyword which helps main me...

Why Java is not pure Object Oriented Language?

 Everyone says that java is a pure object oriented programming language. It covers all OOPs concepts but that is not really true. I'll prove it why. So, there are three points which is contradicting the fact that java is not pure object oriented language. firstly , Java doesn't support multiple inheritance. As, we know that there is no concept of multiple inheritance in java because a class can only extends one class. In other words, a class can only have a single parent . This is violating the OOPs which supports multiple inheritance. Secondly, Java has primitve data types. Java has int, long , bit, short etc data types but in OOPs we can't have primitive data types. This proves that java is not purely Object oriented programming language. Third, Java main method run without the use of its class object. As we can see , we never have to call the main method using dot operator which we generally do on calling any method like- a.sum(); so ,by these three points , we can say j...

OOPS concepts in Java

Image
In my previous blog , I discussed about what Java basically is . Now , let's begin with the necessary concepts of java which made java a purely Object oriented language. Java is known as Highly object oriented language and it covers almost all OOPS concepts by itself. There are mainly 4 OOPS concepts which are to be used by us in future a lot. These are -  1. Inheritance 2. Polymorphism 3. Abstraction 4. Encapsulation Lets first discuss about Inheritance. What Inheritance really is and how it can make our work easier in java. What is Inheritance? As the name suggests , inheritance is used to inherit the properties of something. What is something there? - a class . So , when one class inherits the properties of another class , it is said that inheritance is occurred. The class which inherits the properties is known as subclass and the class which is inherited known as super class.  As shows in this picture , we have 3 types of inheritance in java - 1. Simple Inheritance - Wher...

How well do you know about Java?

okay , so this sounds like we are talking about a person and how much we know about its behaviour and its nature .For me , Java is not too much difficult to understand . We just have to pretend it like we are trying to understand the behaviour of a person who stays in between us and helping us to know others as well. I am too not a perfect java developer but I want to discuss all the topics and concepts which I know and learning , so that everyone can take the benefits of it. So , as this blog's title says - how well do we know about Java? Java is a multi-platform , object-oriented and network-centric language. Sounds like some professional and technical terms ? Don't worry , Let's simplify this in layman terms. so , once again - Java is a multi-platform language means Java runs on different operating systems like Android , Linux , Windows and what helps Java to run on any platform is that when java code compiles it turns code into byte code instead of machine code. So , we...